diff --git a/.gitignore b/.gitignore index c0d9a49c6..b9164d63b 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ bld/ #performance reports & sessions *.vsp *.psess +.vs/ diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Turret.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Turret.cs index 2c24e4926..5d3563d18 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Turret.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Turret.cs @@ -347,6 +347,9 @@ namespace Barotrauma.Items.Components if (returnNull) { var itemContainer = projectileContainer.GetComponent(); + if (itemContainer == null) continue; + if (itemContainer.Inventory == null) continue; + if (itemContainer.Inventory.Items == null) continue; for (int i = 0; i < itemContainer.Inventory.Items.Length; i++) { projectiles.Add(itemContainer.Inventory.Items[i]?.GetComponent());