aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-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 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;