aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java3
1 files changed, 2 insertions, 1 deletions
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 4a4e63c..b94a626 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
@@ -69,7 +69,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;
}
@@ -106,6 +106,7 @@ public class WText extends WWidget {
}
public WText setText(Text text) {
+ Objects.requireNonNull(text, "text is null");
this.text = text;
wrappingScheduled = true;