From 72e42bd257cb612896d0dea4fb1f420829536595 Mon Sep 17 00:00:00 2001 From: juanjp600 Date: Mon, 4 Dec 2017 20:32:22 -0300 Subject: [PATCH] Added try-catch to PhysicsBody.Enabled setter Hopefully this should help us track down what's causing this exception --- .../Source/Physics/PhysicsBody.cs | 17 ++++++++++++++++- .../Farseer Physics MonoGame.csproj | 1 + .../Farseer Physics.csproj | 5 ++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs b/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs index 2a6d52510..4c54d48fd 100644 --- a/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs +++ b/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs @@ -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 diff --git a/Libraries/Farseer Physics Engine 3.5/Farseer Physics MonoGame.csproj b/Libraries/Farseer Physics Engine 3.5/Farseer Physics MonoGame.csproj index 7c89a784a..eea155a8f 100644 --- a/Libraries/Farseer Physics Engine 3.5/Farseer Physics MonoGame.csproj +++ b/Libraries/Farseer Physics Engine 3.5/Farseer Physics MonoGame.csproj @@ -43,6 +43,7 @@ prompt 4 false + bin\WindowsGL\Release\FarseerPhysics MonoGame.xml diff --git a/Libraries/Farseer Physics Engine 3.5/Farseer Physics.csproj b/Libraries/Farseer Physics Engine 3.5/Farseer Physics.csproj index 6676e8f81..9717d5ea3 100644 --- a/Libraries/Farseer Physics Engine 3.5/Farseer Physics.csproj +++ b/Libraries/Farseer Physics Engine 3.5/Farseer Physics.csproj @@ -10,7 +10,7 @@ Properties FarseerPhysics FarseerPhysics - v3.5 + v4.5 512 @@ -39,6 +39,7 @@ false false true + true @@ -50,6 +51,7 @@ 4 AllRules.ruleset bin\Debug\FarseerPhysics.XML + false pdbonly @@ -60,6 +62,7 @@ 4 AllRules.ruleset bin\Release\FarseerPhysics.XML + false