diff options
author | isXander <isxander@users.noreply.github.com> | 2022-09-18 21:55:29 +0100 |
---|---|---|
committer | isXander <isxander@users.noreply.github.com> | 2022-09-18 21:55:29 +0100 |
commit | 405576acaa6e4a9887040a296f8988422351ea3e (patch) | |
tree | 341a9a2ccdb5f68d68ae353a0d75847e1e31954c /src/main | |
parent | 4626ecdf3b74aab2354af809632f3891f51aadcb (diff) | |
download | YetAnotherConfigLib-405576acaa6e4a9887040a296f8988422351ea3e.tar.gz YetAnotherConfigLib-405576acaa6e4a9887040a296f8988422351ea3e.tar.bz2 YetAnotherConfigLib-405576acaa6e4a9887040a296f8988422351ea3e.zip |
fix crash when using search
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/dev/isxander/yacl/api/Option.java | 3 | ||||
-rw-r--r-- | src/main/java/dev/isxander/yacl/gui/YACLScreen.java | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/dev/isxander/yacl/api/Option.java b/src/main/java/dev/isxander/yacl/api/Option.java index 1c3b006..b17743e 100644 --- a/src/main/java/dev/isxander/yacl/api/Option.java +++ b/src/main/java/dev/isxander/yacl/api/Option.java @@ -97,6 +97,9 @@ public interface Option<T> { */ void requestSetDefault(); + /** + * Adds a listener for when the pending value changes + */ void addListener(BiConsumer<Option<T>, T> changedListener); /** diff --git a/src/main/java/dev/isxander/yacl/gui/YACLScreen.java b/src/main/java/dev/isxander/yacl/gui/YACLScreen.java index fc3984d..cef8fec 100644 --- a/src/main/java/dev/isxander/yacl/gui/YACLScreen.java +++ b/src/main/java/dev/isxander/yacl/gui/YACLScreen.java @@ -142,7 +142,7 @@ public class YACLScreen extends Screen { } public void changeCategory(int idx) { - if (currentCategoryIdx != -1 && config.categories().get(idx) instanceof PlaceholderCategory placeholderCategory) { + if (idx != -1 && config.categories().get(idx) instanceof PlaceholderCategory placeholderCategory) { client.setScreen(placeholderCategory.screen().apply(client, this)); } else { currentCategoryIdx = idx; |