From 5adb2d2e37cc5b2c504b38d4b15ce2a57b78b80c Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Mon, 30 Jul 2018 00:19:10 +0200 Subject: [PATCH] Add null check for Perspective.getCanvasTextLoc We have marked it as Nonnull but we were still sending null values inside because of NPC name sometimes being null. Make the param nullable and add null and empty check. Signed-off-by: Tomas Slusny --- .../src/main/java/net/runelite/api/Perspective.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Perspective.java b/runelite-api/src/main/java/net/runelite/api/Perspective.java index 7f848c9521..ac4e330afc 100644 --- a/runelite-api/src/main/java/net/runelite/api/Perspective.java +++ b/runelite-api/src/main/java/net/runelite/api/Perspective.java @@ -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);