diff options
author | Falkreon <falkreon@gmail.com> | 2019-08-22 20:57:21 -0500 |
---|---|---|
committer | Falkreon <falkreon@gmail.com> | 2019-08-22 20:57:21 -0500 |
commit | d17ec9d9299b7dae2964d7314a60502b56f7e12b (patch) | |
tree | 4d58ad4cbd681fb89958692f98b2fe53d66d1504 | |
parent | 873fd6354c7a42b74e5043b38701ad9fe60d8a23 (diff) | |
download | LibGui-d17ec9d9299b7dae2964d7314a60502b56f7e12b.tar.gz LibGui-d17ec9d9299b7dae2964d7314a60502b56f7e12b.tar.bz2 LibGui-d17ec9d9299b7dae2964d7314a60502b56f7e12b.zip |
Fix NPE on WTextField.setText
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java index 58f8a97..217e5d3 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java @@ -66,7 +66,7 @@ public class WTextField extends WWidget { } public void setText(String s) { - if (this.textPredicate.test(s)) { + if (this.textPredicate==null || this.textPredicate.test(s)) { this.text = (s.length()>maxLength) ? s.substring(0,maxLength) : s; if (onChanged!=null) onChanged.accept(this.text); } @@ -544,6 +544,10 @@ public class WTextField extends WWidget { } } + public void insertText(int ofs, String s) { + //TODO: Implement + } + @Override public void onKeyPressed(int ch, int key, int modifiers) { if (!this.editable) return; |