NPE fix
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
c09faed7a7
commit
7e752644d9
@ -466,7 +466,15 @@ public class ItemUtils {
|
|||||||
return (String)item.getData(EntityDataStrings.ITEM_ICON);
|
return (String)item.getData(EntityDataStrings.ITEM_ICON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the equip class of the item
|
||||||
|
* @param item The item
|
||||||
|
* @return The equip class of the item. Null if null is passed in
|
||||||
|
*/
|
||||||
public static String getEquipClass(Entity item){
|
public static String getEquipClass(Entity item){
|
||||||
|
if(item == null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return (String)item.getData(EntityDataStrings.ITEM_EQUIP_CLASS);
|
return (String)item.getData(EntityDataStrings.ITEM_EQUIP_CLASS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,4 +24,11 @@ public class ItemUtilsUnitTests {
|
|||||||
Assertions.assertEquals(false, result);
|
Assertions.assertEquals(false, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UnitTest
|
||||||
|
@FastTest
|
||||||
|
public void getEquipClass_NullEntity_False(){
|
||||||
|
String result = ItemUtils.getEquipClass(null);
|
||||||
|
Assertions.assertEquals(null, result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user