- Some of the non-game-crashing error messages are sent to GameAnalytics.

- Changed crash severity from Error to Critical.
- Exception handling when loading submarine preview images.
- Checking if position is valid in Ragdoll.SetPosition.
This commit is contained in:
Joonas Rikkonen
2018-07-19 21:13:18 +03:00
parent 7756cc0908
commit f1c4bd3c67
13 changed files with 109 additions and 17 deletions
@@ -300,9 +300,19 @@ namespace Barotrauma
string previewImageData = doc.Root.GetAttributeString("previewimage", "");
if (!string.IsNullOrEmpty(previewImageData))
{
using (MemoryStream mem = new MemoryStream(Convert.FromBase64String(previewImageData)))
try
{
PreviewImage = new Sprite(TextureLoader.FromStream(mem), null, null);
using (MemoryStream mem = new MemoryStream(Convert.FromBase64String(previewImageData)))
{
PreviewImage = new Sprite(TextureLoader.FromStream(mem), null, null);
}
}
catch (Exception e)
{
DebugConsole.ThrowError("Loading the preview image of the submarine \"" + Name + "\" failed. The file may be corrupted.", e);
GameAnalyticsManager.AddErrorEventOnce("Submarine..ctor:PreviewImageLoadingFailed", GameAnalyticsSDK.Net.EGAErrorSeverity.Error,
"Loading the preview image of the submarine \"" + Name + "\" failed. The file may be corrupted.");
PreviewImage = null;
}
}
#endif