diff options
author | Lulonaut <lulonaut@tutanota.de> | 2021-09-08 14:17:55 +0200 |
---|---|---|
committer | Lulonaut <lulonaut@tutanota.de> | 2021-09-08 14:17:55 +0200 |
commit | 818dc8f0d7711a4036d83db1304f7f776ce47f39 (patch) | |
tree | 8be8dfd38ffa0dfcda5c177697541aba348b4315 /src/main | |
parent | 4886341cbc1009c1f6a67807f6ed24c28a124884 (diff) | |
download | NotEnoughUpdates-818dc8f0d7711a4036d83db1304f7f776ce47f39.tar.gz NotEnoughUpdates-818dc8f0d7711a4036d83db1304f7f776ce47f39.tar.bz2 NotEnoughUpdates-818dc8f0d7711a4036d83db1304f7f776ce47f39.zip |
make sure there are autocompleted items
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java | 20 |
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); |