diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RangedWeapon.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RangedWeapon.cs index de0f31eb8..552e5d13e 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RangedWeapon.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RangedWeapon.cs @@ -170,6 +170,7 @@ namespace Barotrauma.Items.Components projectile.Item.SetTransform(projectilePos, rotation); projectile.Use(deltaTime); + if (projectile.Item.Removed) { return true; } projectile.User = character; projectile.Item.body.ApplyTorque(projectile.Item.body.Mass * degreeOfFailure * Rand.Range(-10.0f, 10.0f)); diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Projectile.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Projectile.cs index 12375fecf..d155ff108 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Projectile.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Projectile.cs @@ -275,7 +275,14 @@ namespace Barotrauma.Items.Components //the raycast didn't hit anything -> the projectile flew somewhere outside the level and is permanently lost if (!hitSomething) { - Entity.Spawner.AddToRemoveQueue(item); + if (Entity.Spawner == null) + { + item.Remove(); + } + else + { + Entity.Spawner.AddToRemoveQueue(item); + } } }