Do not try to draw infobox caption if text is null or empty
Closes #7964 Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.ui.overlay.components;
|
package net.runelite.client.ui.overlay.components;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.FontMetrics;
|
import java.awt.FontMetrics;
|
||||||
@@ -86,11 +87,14 @@ public class InfoBoxComponent implements LayoutableRenderableEntity
|
|||||||
null);
|
null);
|
||||||
|
|
||||||
// Render caption
|
// Render caption
|
||||||
final TextComponent textComponent = new TextComponent();
|
if (!Strings.isNullOrEmpty(text))
|
||||||
textComponent.setColor(color);
|
{
|
||||||
textComponent.setText(text);
|
final TextComponent textComponent = new TextComponent();
|
||||||
textComponent.setPosition(new Point(baseX + ((size - metrics.stringWidth(text)) / 2), baseY + size - SEPARATOR));
|
textComponent.setColor(color);
|
||||||
textComponent.render(graphics);
|
textComponent.setText(text);
|
||||||
|
textComponent.setPosition(new Point(baseX + ((size - metrics.stringWidth(text)) / 2), baseY + size - SEPARATOR));
|
||||||
|
textComponent.render(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
this.bounds.setBounds(bounds);
|
this.bounds.setBounds(bounds);
|
||||||
return bounds.getSize();
|
return bounds.getSize();
|
||||||
|
|||||||
Reference in New Issue
Block a user