crash gently with malformed itemstack data
This commit is contained in:
1 parent
5d21d50b8b
commit
77603e16e9
3 files changed
+6
-6
No files matched your search
@@ -888,7 +888,7 @@ public class WorldAccess
|
||||
ItemStack tool;
|
||||
if (tag != null)
|
||||
{
|
||||
tool = ItemStack.CODEC.parse(regs.createSerializationContext(NbtOps.INSTANCE), tag).result().orElse(null);
|
||||
tool = ItemStack.CODEC.parse(regs.createSerializationContext(NbtOps.INSTANCE), tag).getOrThrow(s -> new InternalExpressionException("Failed to parse item stack data: " + s));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -956,7 +956,7 @@ public class WorldAccess
|
||||
{
|
||||
return Value.NULL;
|
||||
}
|
||||
return new NBTSerializableValue(() -> ItemStack.CODEC.encodeStart(regs.createSerializationContext(NbtOps.INSTANCE), tool).getOrThrow());
|
||||
return new NBTSerializableValue(() -> ItemStack.CODEC.encodeStart(regs.createSerializationContext(NbtOps.INSTANCE), tool).getOrThrow(s -> new InternalExpressionException("Failed to parse item stack data: " + s)));
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user