From 86d6f706e9508f78d147f5c810973a1e8f59496c Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Wed, 21 Feb 2024 17:46:27 +0100 Subject: [PATCH] Fix crash when ID for Item.getItemByID = "" --- P3D/Pokemon/Items/Item.vb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/P3D/Pokemon/Items/Item.vb b/P3D/Pokemon/Items/Item.vb index f6bced0ee..08eb3de2a 100644 --- a/P3D/Pokemon/Items/Item.vb +++ b/P3D/Pokemon/Items/Item.vb @@ -388,11 +388,13 @@ Public MustInherit Class Item LoadItemBuffer() End If - Dim type = _itemBuffer.FirstOrDefault(Function(itemTypePair) - Return itemTypePair.Key.Id = CInt(ID) - End Function).Value - If type IsNot Nothing Then - Return CType(Activator.CreateInstance(type), Item) + If ID <> "" Then + Dim type = _itemBuffer.FirstOrDefault(Function(itemTypePair) + Return itemTypePair.Key.Id = CInt(ID) + End Function).Value + If type IsNot Nothing Then + Return CType(Activator.CreateInstance(type), Item) + End If End If End If