Fixed NullReferenceExceptions when dragging an item that isn't in any slot (i.e. a wire)
This commit is contained in:
@@ -245,7 +245,8 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (draggingItem != null && !draggingSlot.Rect.Contains(PlayerInput.MousePosition) && draggingItem.ParentInventory == this)
|
if (draggingItem != null &&
|
||||||
|
(draggingSlot == null || (!draggingSlot.Rect.Contains(PlayerInput.MousePosition) && draggingItem.ParentInventory == this)))
|
||||||
{
|
{
|
||||||
if (!PlayerInput.LeftButtonHeld())
|
if (!PlayerInput.LeftButtonHeld())
|
||||||
{
|
{
|
||||||
@@ -277,8 +278,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (draggingItem != null &&
|
if (draggingItem != null &&
|
||||||
!draggingSlot.Rect.Contains(PlayerInput.MousePosition) &&
|
(draggingSlot == null || (!draggingSlot.Rect.Contains(PlayerInput.MousePosition) && draggingItem.ParentInventory == this)))
|
||||||
draggingItem.ParentInventory == this)
|
|
||||||
{
|
{
|
||||||
Rectangle dragRect = new Rectangle(
|
Rectangle dragRect = new Rectangle(
|
||||||
(int)PlayerInput.MousePosition.X - 10,
|
(int)PlayerInput.MousePosition.X - 10,
|
||||||
|
|||||||
Reference in New Issue
Block a user