aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorLulonaut <lulonaut@tutanota.de>2021-09-08 14:17:55 +0200
committerLulonaut <lulonaut@tutanota.de>2021-09-08 14:17:55 +0200
commit818dc8f0d7711a4036d83db1304f7f776ce47f39 (patch)
tree8be8dfd38ffa0dfcda5c177697541aba348b4315 /src/main/java
parent4886341cbc1009c1f6a67807f6ed24c28a124884 (diff)
downloadNotEnoughUpdates-818dc8f0d7711a4036d83db1304f7f776ce47f39.tar.gz
NotEnoughUpdates-818dc8f0d7711a4036d83db1304f7f776ce47f39.tar.bz2
NotEnoughUpdates-818dc8f0d7711a4036d83db1304f7f776ce47f39.zip
make sure there are autocompleted items
Diffstat (limited to 'src/main/java')
-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);