From ee7aee131ee5f97be903976975a958624f8bd2d2 Mon Sep 17 00:00:00 2001 From: pfthroaway Date: Sat, 2 Nov 2019 20:00:03 -0500 Subject: [PATCH] Prevented a crash if you don't click in a slot. If you clicked in between slots or anywhere outside, it crashed because Godot apparently doesn't handle null checks well enough. --- Inventory.gd | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Inventory.gd b/Inventory.gd index b56c710..173d9ac 100644 --- a/Inventory.gd +++ b/Inventory.gd @@ -69,7 +69,10 @@ func _gui_input(event): if isClicked: clickedSlot = slot; - if holdingItem != null: + if holdingItem == null and clickedSlot == null: + return + + if holdingItem != null and clickedSlot != null: if clickedSlot.item != null: var tempItem = clickedSlot.item; var oldSlot = slotList[slotList.find(holdingItem.itemSlot)];