Merge pull request #4558 from deathbeam/fix-null-and-emtpy-names

Fix NPE when trying to draw null names
This commit is contained in:
Tomas Slusny
2018-07-30 10:32:01 +02:00
committed by GitHub
2 changed files with 13 additions and 3 deletions

View File

@@ -373,10 +373,14 @@ public class Perspective
@Nonnull Client client,
@Nonnull Graphics2D graphics,
@Nonnull LocalPoint localLocation,
@Nonnull String text,
int zOffset
)
@Nullable String text,
int zOffset)
{
if (text == null || "".equals(text))
{
return null;
}
int plane = client.getPlane();
Point p = worldToCanvas(client, localLocation.getX(), localLocation.getY(), plane, zOffset);

View File

@@ -24,6 +24,7 @@
*/
package net.runelite.client.ui.overlay;
import com.google.common.base.Strings;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
@@ -67,6 +68,11 @@ public class OverlayUtil
public static void renderTextLocation(Graphics2D graphics, Point txtLoc, String text, Color color)
{
if (Strings.isNullOrEmpty(text))
{
return;
}
int x = txtLoc.getX();
int y = txtLoc.getY();