Fixed railgun HUD crash when the first linked item doesn't have an ItemContainer
This commit is contained in:
@@ -16,3 +16,4 @@ bld/
|
|||||||
#performance reports & sessions
|
#performance reports & sessions
|
||||||
*.vsp
|
*.vsp
|
||||||
*.psess
|
*.psess
|
||||||
|
.vs/
|
||||||
|
|||||||
@@ -347,6 +347,9 @@ namespace Barotrauma.Items.Components
|
|||||||
if (returnNull)
|
if (returnNull)
|
||||||
{
|
{
|
||||||
var itemContainer = projectileContainer.GetComponent<ItemContainer>();
|
var itemContainer = projectileContainer.GetComponent<ItemContainer>();
|
||||||
|
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++)
|
for (int i = 0; i < itemContainer.Inventory.Items.Length; i++)
|
||||||
{
|
{
|
||||||
projectiles.Add(itemContainer.Inventory.Items[i]?.GetComponent<Projectile>());
|
projectiles.Add(itemContainer.Inventory.Items[i]?.GetComponent<Projectile>());
|
||||||
|
|||||||
Reference in New Issue
Block a user