(51d0e9a7a) Fixed crashing when firing a revolver in the sub editor. Closes #1631

This commit is contained in:
Joonas Rikkonen
2019-06-14 12:22:55 +03:00
parent 34d0d1e9f8
commit 1130eef310
2 changed files with 9 additions and 1 deletions

View File

@@ -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));

View File

@@ -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);
}
}
}