From 3517075c7f635724f7c414dc1f333ad845c11ab8 Mon Sep 17 00:00:00 2001 From: Juuxel <6596629+Juuxel@users.noreply.github.com> Date: Mon, 13 Apr 2020 21:14:29 +0300 Subject: Fix #45 --- src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java index ebf74b2..9761a6d 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java @@ -72,7 +72,7 @@ public class WText extends WWidget { @Environment(EnvType.CLIENT) @Override public void paintBackground(int x, int y, int mouseX, int mouseY) { - if (wrappingScheduled) { + if (wrappedLines == null || wrappingScheduled) { wrapLines(); wrappingScheduled = false; } @@ -110,6 +110,7 @@ public class WText extends WWidget { } public WText setText(Text text) { + Objects.requireNonNull(text, "text is null"); this.text = text; wrappingScheduled = true; -- cgit