Skip to content

Commit

Permalink
Fix NPE when interacting / closing blank config GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyvest committed Dec 19, 2023
1 parent ae6f883 commit 1200fad
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,20 @@ public void finishUpAndClose() {

@Override
public void keyTyped(char key, int keyCode) {
if (page.categories.size() == 0) return;
if (page.categories.isEmpty()) return;
for (OptionSubcategory subCategory : getSubcategories()) {
for (BasicOption option : subCategory.options) {
option.keyTyped(key, keyCode);
}
}
}

private final ArrayList<OptionSubcategory> empty = new ArrayList<>();

private List<OptionSubcategory> getSubcategories() {
if (OneConfigGui.INSTANCE.getSearchValue().isEmpty()) {
return page.categories.get(selectedCategory).subcategories;
if (page.categories.isEmpty()) return empty;
else return page.categories.get(selectedCategory).subcategories;
} else {
List<OptionSubcategory> subcategories = new ArrayList<>();
for (Map.Entry<String, OptionCategory> category : page.categories.entrySet()) {
Expand Down

0 comments on commit 1200fad

Please sign in to comment.