prevent from missing keys causing NPE
This commit is contained in:
1 parent
7a4f3361b2
commit
8d17abfbe8
1 file changed
+4
-2
@@ -218,11 +218,13 @@ public class CarpetExpression
|
|||||||
Value v0 = params.get(0).evalValue(c);
|
Value v0 = params.get(0).evalValue(c);
|
||||||
if (v0 instanceof BlockValue)
|
if (v0 instanceof BlockValue)
|
||||||
{
|
{
|
||||||
Value retval = new StringValue(test.apply( ((BlockValue) v0).getBlockState(), ((BlockValue) v0).getPos()));
|
String strVal = test.apply( ((BlockValue) v0).getBlockState(), ((BlockValue) v0).getPos());
|
||||||
|
Value retval = strVal != null ? new StringValue(strVal) : Value.NULL;
|
||||||
return (c_, t_) -> retval;
|
return (c_, t_) -> retval;
|
||||||
}
|
}
|
||||||
BlockValue block = BlockValue.fromParams(cc, params, 0).block;
|
BlockValue block = BlockValue.fromParams(cc, params, 0).block;
|
||||||
Value retval = new StringValue(test.apply(block.getBlockState(), block.getPos()));
|
String strVal = test.apply(block.getBlockState(), block.getPos());
|
||||||
|
Value retval = strVal != null ? new StringValue(strVal) : Value.NULL;
|
||||||
return (c_, t_) -> retval;
|
return (c_, t_) -> retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user