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;
|
||||
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user