From f8304ceb7eb36c70a7cc19db261430a6321ab6f9 Mon Sep 17 00:00:00 2001 From: Regalis Date: Mon, 27 Feb 2017 20:55:23 +0200 Subject: [PATCH] Workaround for exceptions in SetTransformIgnoreContacts http://undertowgames.com/forum/viewtopic.php?f=21&t=5915#p112558 --- Subsurface/Source/Items/Item.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Subsurface/Source/Items/Item.cs b/Subsurface/Source/Items/Item.cs index d28873cee..d7802d5b0 100644 --- a/Subsurface/Source/Items/Item.cs +++ b/Subsurface/Source/Items/Item.cs @@ -598,7 +598,18 @@ namespace Barotrauma if (contained.body != null) { - contained.body.FarseerBody.SetTransformIgnoreContacts(ref simPos, 0.0f); + try + { + 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 =