aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java
index 641f8a93..8b3b21f0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java
@@ -335,15 +335,17 @@ public class AuctionSearchOverlay {
searchStringExtra = "";
close();
} else if(Keyboard.getEventKey() == Keyboard.KEY_TAB){
- searchString = autocompletedItems.iterator().next();
- JsonObject repoObject = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(autocompletedItems.iterator().next());
- String displayname = repoObject.get("displayname").getAsString();
- if (displayname.contains("Enchanted Book")){
- String lore = repoObject.get("lore").getAsJsonArray().iterator().next().getAsString();
- String name = lore.substring(0, lore.lastIndexOf(" "));
- searchString = Utils.cleanColour(name);
- } else {
- searchString = Utils.cleanColour(displayname);
+ if (!autocompletedItems.isEmpty()) {
+ searchString = autocompletedItems.iterator().next();
+ JsonObject repoObject = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(autocompletedItems.iterator().next());
+ String displayname = repoObject.get("displayname").getAsString();
+ if (displayname.contains("Enchanted Book")){
+ String lore = repoObject.get("lore").getAsJsonArray().iterator().next().getAsString();
+ String name = lore.substring(0, lore.lastIndexOf(" "));
+ searchString = Utils.cleanColour(name);
+ } else {
+ searchString = Utils.cleanColour(displayname);
+ }
}
} else if(Keyboard.getEventKeyState()) {
textField.setFocus(true);