runelite-client: fix npe in fps overlay if the xp orb is not loaded

This commit is contained in:
Adam
2017-06-14 21:27:15 -04:00
parent 7393b9715e
commit 1cc849dbe5

View File

@@ -69,6 +69,11 @@ public class FPSOverlay extends Overlay
String str = String.valueOf(client.getFPS());
Widget xpOrb = client.getWidget(WidgetInfo.MINIMAP_XP_ORG);
if (xpOrb == null)
{
return null;
}
Rectangle2D bounds = xpOrb.getBounds().getBounds2D();
int x = (int) (bounds.getX() + ((bounds.getWidth() / 2) - (fm.stringWidth(str) / 2)));
@@ -87,4 +92,4 @@ public class FPSOverlay extends Overlay
return new Dimension(fm.stringWidth(str), fm.getHeight());
}
}
}