Skip to content

Commit 5c2f7f1

Browse files
committed
Add null check for $item in ItemStackData deserialization...
1 parent c3663be commit 5c2f7f1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/kostamax27/VanillaLootTables/entry/ItemStackData.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ public function generate(LootContext $context, array $functions = []) : array{
4848
}catch(ItemTypeDeserializeException $e){
4949
//TODO: this is not the best way...
5050
$item = StringToItemParser::getInstance()->parse($this->name);
51-
$item?->setCount($count);
51+
if($item === null){
52+
return $items;
53+
}
54+
$item->setCount($count);
5255
}
5356

5457
foreach($functions as $function){

0 commit comments

Comments
 (0)