Merge pull request #7965 from deathbeam/fix-text
Do not try to draw infobox caption if text is null or empty
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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user