runelite-client: fix npe in fps overlay if the xp orb is not loaded
This commit is contained in:
@@ -69,6 +69,11 @@ public class FPSOverlay extends Overlay
|
|||||||
String str = String.valueOf(client.getFPS());
|
String str = String.valueOf(client.getFPS());
|
||||||
|
|
||||||
Widget xpOrb = client.getWidget(WidgetInfo.MINIMAP_XP_ORG);
|
Widget xpOrb = client.getWidget(WidgetInfo.MINIMAP_XP_ORG);
|
||||||
|
if (xpOrb == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle2D bounds = xpOrb.getBounds().getBounds2D();
|
Rectangle2D bounds = xpOrb.getBounds().getBounds2D();
|
||||||
|
|
||||||
int x = (int) (bounds.getX() + ((bounds.getWidth() / 2) - (fm.stringWidth(str) / 2)));
|
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());
|
return new Dimension(fm.stringWidth(str), fm.getHeight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user