From d17ec9d9299b7dae2964d7314a60502b56f7e12b Mon Sep 17 00:00:00 2001 From: Falkreon Date: Thu, 22 Aug 2019 20:57:21 -0500 Subject: Fix NPE on WTextField.setText --- src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main') 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; -- cgit