Permalink
Browse files

Handle null item arguments in certain inventory functions

  • Loading branch information...
PseudoKnight committed Aug 23, 2018
1 parent 20de128 commit a42c09c98ad9c225dfeb6c04659bfb2fbcbacf0e
Showing with 20 additions and 1 deletion.
  1. +20 −1 src/main/java/com/laytonsmith/core/functions/InventoryManagement.java
@@ -656,6 +656,10 @@ public Construct exec(Target t, Environment environment, Construct... args) thro
c = args[1];
}
if(c instanceof CNull) {
return new CInt(0, t);
}
if(c instanceof CArray) {
ca = (CArray) c;
is = ObjectGenerator.GetGenerator().item(ca, t);
@@ -758,7 +762,10 @@ public Construct exec(Target t, Environment environment, Construct... args) thro
item = args[1];
}
MCItemStack is;
if(item instanceof CArray) {
if(item instanceof CNull) {
ca = null;
is = StaticLayer.GetItemStack("AIR", 1);
} else if(item instanceof CArray) {
ca = (CArray) item;
is = ObjectGenerator.GetGenerator().item(ca, t);
} else {
@@ -863,6 +870,9 @@ public Construct exec(Target t, Environment environment, Construct... args) thro
int itemOffset = 0;
if(args.length == 2) {
if(args[1] instanceof CNull) {
return new CInt(0, t);
}
if(args[1] instanceof CArray) {
itemOffset = 1;
}
@@ -972,6 +982,9 @@ public Construct exec(Target t, Environment environment, Construct... args) thro
CArray ca = null;
if(args.length == 2) {
if(args[1] instanceof CNull) {
return new CInt(0, t);
}
if(args[1] instanceof CArray) {
itemOffset = 1;
}
@@ -1092,6 +1105,9 @@ public Construct exec(Target t, Environment environment, Construct... args) thro
int itemOffset = 0;
if(args.length == 2) {
if(args[1] instanceof CNull) {
return new CInt(0, t);
}
if(args[1] instanceof CArray) {
itemOffset = 1;
}
@@ -1198,6 +1214,9 @@ public Construct exec(Target t, Environment environment, Construct... args) thro
CArray ca = null;
if(args.length == 2) {
if(args[1] instanceof CNull) {
return new CInt(0, t);
}
if(args[1] instanceof CArray) {
itemOffset = 1;
}

0 comments on commit a42c09c

Please sign in to comment.