diff --git a/Barotrauma/BarotraumaShared/Source/GameAnalyticsManager.cs b/Barotrauma/BarotraumaShared/Source/GameAnalyticsManager.cs index 36cc8fbe1..b276e7ed7 100644 --- a/Barotrauma/BarotraumaShared/Source/GameAnalyticsManager.cs +++ b/Barotrauma/BarotraumaShared/Source/GameAnalyticsManager.cs @@ -34,17 +34,25 @@ namespace Barotrauma { DebugConsole.ThrowError("Error while calculating MD5 hash for the executable \"" + exePath + "\"", e); } + try + { + GameAnalytics.ConfigureBuild(GameMain.Version.ToString() + + (string.IsNullOrEmpty(exeName) ? "Unknown" : exeName) + ":" + + ((exeHash?.ShortHash == null) ? "Unknown" : exeHash.ShortHash)); - GameAnalytics.ConfigureBuild(GameMain.Version.ToString() - + (string.IsNullOrEmpty(exeName) ? "Unknown" : exeName) + ":" - + ((exeHash?.ShortHash == null) ? "Unknown" : exeHash.ShortHash)); - - GameAnalytics.AddDesignEvent("Executable:" - + (string.IsNullOrEmpty(exeName) ? "Unknown" : exeName) + ":" - + ((exeHash?.ShortHash == null) ? "Unknown" : exeHash.ShortHash)); + GameAnalytics.AddDesignEvent("Executable:" + + (string.IsNullOrEmpty(exeName) ? "Unknown" : exeName) + ":" + + ((exeHash?.ShortHash == null) ? "Unknown" : exeHash.ShortHash)); - GameAnalytics.ConfigureAvailableCustomDimensions01("singleplayer", "multiplayer", "editor"); - GameAnalytics.Initialize("a3a073c20982de7c15d21e840e149122", "9010ad9a671233b8d9610d76cec8c897d9ff3ba7"); + GameAnalytics.ConfigureAvailableCustomDimensions01("singleplayer", "multiplayer", "editor"); + GameAnalytics.Initialize("a3a073c20982de7c15d21e840e149122", "9010ad9a671233b8d9610d76cec8c897d9ff3ba7"); + } + catch (Exception e) + { + DebugConsole.ThrowError("Initializing GameAnalytics failed. Disabling user statistics...", e); + GameSettings.SendUserStatistics = false; + return; + } string contentPackageName = GameMain.Config?.SelectedContentPackage?.Name; if (!string.IsNullOrEmpty(contentPackageName))