Added try-catch to PhysicsBody.Enabled setter

Hopefully this should help us track down what's causing this exception
This commit is contained in:
juanjp600
2017-12-04 20:32:22 -03:00
parent a0782e5d8d
commit 72e42bd257
3 changed files with 21 additions and 2 deletions
@@ -169,7 +169,22 @@ namespace Barotrauma
public bool Enabled
{
get { return isEnabled; }
set { isEnabled = value; if (isEnabled) body.Enabled = isPhysEnabled; else body.Enabled = false; }
set
{
isEnabled = value;
try
{
if (isEnabled) body.Enabled = isPhysEnabled; else body.Enabled = false;
}
catch (Exception e)
{
DebugConsole.ThrowError("Exception in PhysicsBody.Enabled = "+value+" ("+isPhysEnabled+")",e);
if (UserData!=null) DebugConsole.NewMessage("PhysicsBody UserData: "+UserData.GetType().ToString(), Color.Red);
if (GameMain.World.ContactManager == null) DebugConsole.NewMessage("ContactManager is null!", Color.Red);
else if (GameMain.World.ContactManager.BroadPhase == null) DebugConsole.NewMessage("Broadphase is null!", Color.Red);
if (body.FixtureList == null) DebugConsole.NewMessage("FixtureList is null!", Color.Red);
}
}
}
public bool PhysEnabled