From 7df862de4d32262699f1ee76e63825ec14d726b2 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Thu, 21 Feb 2019 16:05:10 +0100 Subject: [PATCH 1/2] Do not try to draw infobox caption if text is null or empty Closes #7964 Signed-off-by: Tomas Slusny --- .../ui/overlay/components/InfoBoxComponent.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/InfoBoxComponent.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/InfoBoxComponent.java index be055179bb..d8f7841099 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/InfoBoxComponent.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/InfoBoxComponent.java @@ -24,6 +24,7 @@ */ package net.runelite.client.ui.overlay.components; +import com.google.common.base.Strings; import java.awt.Color; import java.awt.Dimension; import java.awt.FontMetrics; @@ -86,11 +87,14 @@ public class InfoBoxComponent implements LayoutableRenderableEntity null); // Render caption - final TextComponent textComponent = new TextComponent(); - textComponent.setColor(color); - textComponent.setText(text); - textComponent.setPosition(new Point(baseX + ((size - metrics.stringWidth(text)) / 2), baseY + size - SEPARATOR)); - textComponent.render(graphics); + if (!Strings.isNullOrEmpty(text)) + { + final TextComponent textComponent = new TextComponent(); + textComponent.setColor(color); + textComponent.setText(text); + textComponent.setPosition(new Point(baseX + ((size - metrics.stringWidth(text)) / 2), baseY + size - SEPARATOR)); + textComponent.render(graphics); + } this.bounds.setBounds(bounds); return bounds.getSize(); From dad7b05e6a39118ffa040fd9e84466d6e0c841bb Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Thu, 21 Feb 2019 16:41:53 +0100 Subject: [PATCH 2/2] Remove emptyOrNull text check from InfoboxOverlay This is unnecessary as it should be checked when drawing the text. Signed-off-by: Tomas Slusny --- .../runelite/client/ui/overlay/infobox/InfoBoxOverlay.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxOverlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxOverlay.java index e6a8d6f749..58f20aae63 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/infobox/InfoBoxOverlay.java @@ -99,10 +99,7 @@ public class InfoBoxOverlay extends Overlay final Color color = box.getTextColor(); final InfoBoxComponent infoBoxComponent = new InfoBoxComponent(); - if (!Strings.isNullOrEmpty(text)) - { - infoBoxComponent.setText(text); - } + infoBoxComponent.setText(text); if (color != null) { infoBoxComponent.setColor(color);