Workaround for exceptions in SetTransformIgnoreContacts

http://undertowgames.com/forum/viewtopic.php?f=21&t=5915#p112558
This commit is contained in:
Regalis
2017-02-27 20:55:23 +02:00
parent b635a61bb4
commit f8304ceb7e
+11
View File
@@ -597,10 +597,21 @@ namespace Barotrauma
if (contained == null) continue; if (contained == null) continue;
if (contained.body != null) if (contained.body != null)
{
try
{ {
contained.body.FarseerBody.SetTransformIgnoreContacts(ref simPos, 0.0f); contained.body.FarseerBody.SetTransformIgnoreContacts(ref simPos, 0.0f);
} }
catch (NullReferenceException e)
{
#if DEBUG
DebugConsole.ThrowError("SetTransformIgnoreContacts threw an exception in SetContainedItemPositions", e);
#endif
contained.body.SetTransform(simPos, 0.0f);
}
}
contained.Rect = contained.Rect =
new Rectangle( new Rectangle(
(int)(displayPos.X - contained.Rect.Width / 2.0f), (int)(displayPos.X - contained.Rect.Width / 2.0f),