NPE fix
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-09-03 23:20:36 -04:00
parent c09faed7a7
commit 7e752644d9
2 changed files with 15 additions and 0 deletions

View File

@ -466,7 +466,15 @@ public class ItemUtils {
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){
if(item == null){
return null;
}
return (String)item.getData(EntityDataStrings.ITEM_EQUIP_CLASS);
}

View File

@ -24,4 +24,11 @@ public class ItemUtilsUnitTests {
Assertions.assertEquals(false, result);
}
@UnitTest
@FastTest
public void getEquipClass_NullEntity_False(){
String result = ItemUtils.getEquipClass(null);
Assertions.assertEquals(null, result);
}
}