(2be015bd1) Added: Code hardening due to a crash where the item was null
This commit is contained in:
@@ -338,15 +338,19 @@ namespace Barotrauma.Items.Components
|
|||||||
canPlaceNode = true;
|
canPlaceNode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2 relativeNodePos = newNodePos - item.Position;
|
if (item != null)
|
||||||
if (sub != null)
|
|
||||||
{
|
{
|
||||||
relativeNodePos += sub.HiddenSubPosition;
|
Vector2 relativeNodePos = newNodePos - item.Position;
|
||||||
}
|
|
||||||
|
|
||||||
sectionExtents = new Vector2(
|
if (sub != null)
|
||||||
Math.Max(Math.Abs(relativeNodePos.X), sectionExtents.X),
|
{
|
||||||
Math.Max(Math.Abs(relativeNodePos.Y), sectionExtents.Y));
|
relativeNodePos += sub.HiddenSubPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
sectionExtents = new Vector2(
|
||||||
|
Math.Max(Math.Abs(relativeNodePos.X), sectionExtents.X),
|
||||||
|
Math.Max(Math.Abs(relativeNodePos.Y), sectionExtents.Y));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Use(float deltaTime, Character character = null)
|
public override bool Use(float deltaTime, Character character = null)
|
||||||
|
|||||||
Reference in New Issue
Block a user