diff --git a/Java-Knight/src/main/java/org/project/util/DisplayItem.java b/Java-Knight/src/main/java/org/project/util/DisplayItem.java index 4d7d908..07af740 100644 --- a/Java-Knight/src/main/java/org/project/util/DisplayItem.java +++ b/Java-Knight/src/main/java/org/project/util/DisplayItem.java @@ -15,6 +15,8 @@ import java.util.Hashtable; public class DisplayItem { public static void DisplayItems(ArrayList items) { for (Item item : items) { + if (item == null) continue; + String result = item.getName(); if (item instanceof SellableItem) { @@ -30,7 +32,7 @@ public class DisplayItem { } if (item instanceof IDefender) { - result += "\n Damage = " + ((IDefender) item).GetDefense(); + result += "\n Defence = " + ((IDefender) item).GetDefense(); } System.out.println(result); @@ -42,6 +44,8 @@ public class DisplayItem { Dictionary dictionary = new Hashtable<>(); for (Item item : items) { + if (item == null) continue; + String result = index + " > " + item.getName(); if (item instanceof KeyItem) { @@ -61,7 +65,7 @@ public class DisplayItem { } if (item instanceof IDefender) { - result += "\n Damage = " + ((IDefender) item).GetDefense(); + result += "\n Defence = " + ((IDefender) item).GetDefense(); } dictionary.put(index, item);