(99e6eb7c7) Fixed "attempted to access a potentially removed ragdoll" in SoundPlayer.Update, set Character.Controlled to null if the character is removed to prevent this from happening elsewhere
This commit is contained in:
@@ -47,7 +47,6 @@ namespace Barotrauma
|
|||||||
controlled = value;
|
controlled = value;
|
||||||
if (controlled != null) controlled.Enabled = true;
|
if (controlled != null) controlled.Enabled = true;
|
||||||
CharacterHealth.OpenHealthWindow = null;
|
CharacterHealth.OpenHealthWindow = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
float ambienceVolume = 0.8f;
|
float ambienceVolume = 0.8f;
|
||||||
if (Character.Controlled != null)
|
if (Character.Controlled != null && !Character.Controlled.Removed)
|
||||||
{
|
{
|
||||||
AnimController animController = Character.Controlled.AnimController;
|
AnimController animController = Character.Controlled.AnimController;
|
||||||
if (animController.HeadInWater)
|
if (animController.HeadInWater)
|
||||||
|
|||||||
@@ -2546,10 +2546,14 @@ namespace Barotrauma
|
|||||||
|
|
||||||
base.Remove();
|
base.Remove();
|
||||||
|
|
||||||
if (selectedItems[0] != null) selectedItems[0].Drop(this);
|
if (selectedItems[0] != null) { selectedItems[0].Drop(this); }
|
||||||
if (selectedItems[1] != null) selectedItems[1].Drop(this);
|
if (selectedItems[1] != null) { selectedItems[1].Drop(this); }
|
||||||
|
|
||||||
if (info != null) info.Remove();
|
if (info != null) { info.Remove(); }
|
||||||
|
|
||||||
|
#if CLIENT
|
||||||
|
GameMain.GameSession?.CrewManager?.RemoveCharacter(this);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
GameMain.GameSession?.CrewManager?.RemoveCharacter(this);
|
GameMain.GameSession?.CrewManager?.RemoveCharacter(this);
|
||||||
@@ -2557,6 +2561,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
CharacterList.Remove(this);
|
CharacterList.Remove(this);
|
||||||
|
|
||||||
|
if (Controlled == this) { Controlled = null; }
|
||||||
|
|
||||||
if (Inventory != null)
|
if (Inventory != null)
|
||||||
{
|
{
|
||||||
foreach (Item item in Inventory.Items)
|
foreach (Item item in Inventory.Items)
|
||||||
@@ -2576,8 +2582,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
foreach (Character c in CharacterList)
|
foreach (Character c in CharacterList)
|
||||||
{
|
{
|
||||||
if (c.focusedCharacter == this) c.focusedCharacter = null;
|
if (c.focusedCharacter == this) { c.focusedCharacter = null; }
|
||||||
if (c.SelectedCharacter == this) c.SelectedCharacter = null;
|
if (c.SelectedCharacter == this) { c.SelectedCharacter = null; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
partial void DisposeProjSpecific();
|
partial void DisposeProjSpecific();
|
||||||
|
|||||||
Reference in New Issue
Block a user