aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuuxel <6596629+Juuxel@users.noreply.github.com>2020-04-13 21:14:29 +0300
committerJuuxel <6596629+Juuxel@users.noreply.github.com>2020-04-26 00:41:25 +0300
commit73487371949a9dcc3c67aed69e689ab9390b6230 (patch)
tree394678f39547b41487d7b7beadc5fb16e3d43706
parent095e92e3508f8a32d1910c0619afb31df0657598 (diff)
downloadLibGui-73487371949a9dcc3c67aed69e689ab9390b6230.tar.gz
LibGui-73487371949a9dcc3c67aed69e689ab9390b6230.tar.bz2
LibGui-73487371949a9dcc3c67aed69e689ab9390b6230.zip
Fix #45
-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;