null pointer evasion

This commit is contained in:
2023-07-27 23:10:00 -05:00
parent b28d31ec44
commit 57a38303f8
+6 -2
View File
@@ -123,7 +123,7 @@ public class LootManager {
//iterate the booty tables and add items to mob inventory
MobLoot toAdd = getGenTableItem(bse.lootTable, mob);
if (toAdd != null) {
if(toAdd.getPrefix().isEmpty() == true && toAdd.getSuffix().isEmpty() == true){
if(toAdd.getPrefix() != null && toAdd.getPrefix().isEmpty() == true && toAdd.getSuffix()!= null && toAdd.getSuffix().isEmpty() == true){
toAdd.setIsID(true);
}
mob.getCharItemManager().addItemToInventory(toAdd);
@@ -133,7 +133,7 @@ public class LootManager {
int lootTableID = bse.lootTable + 1;
MobLoot toAddHZ = getGenTableItem(lootTableID, mob);
if (toAddHZ != null)
if(toAdd.getPrefix().isEmpty() == true && toAdd.getSuffix().isEmpty() == true){
if(toAdd.getPrefix() != null && toAdd.getPrefix().isEmpty() == true && toAdd.getSuffix()!= null && toAdd.getSuffix().isEmpty() == true){
toAdd.setIsID(true);
}
mob.getCharItemManager().addItemToInventory(toAddHZ);
@@ -169,6 +169,7 @@ public class LootManager {
public static MobLoot getGenTableItem(int genTableID, Mob mob) {
try {
if (genTableID == 0 || mob == null || generalItemTables.containsKey(genTableID) == false) {
return null;
}
@@ -229,6 +230,9 @@ public class LootManager {
}
}
return outItem;
}catch(Exception e){
return null;
}
}
private static int TableRoll(int mobLevel){
int max = (int)(4.882 * mobLevel + 121.0);