Merge pull request #9635 from dekvall/npe-branch
Fix NPE in groundmarkerplugin and annotate some methods as nullable
This commit is contained in:
@@ -50,6 +50,7 @@ public interface Actor extends Renderable
|
|||||||
*
|
*
|
||||||
* @return the name
|
* @return the name
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -345,6 +345,7 @@ public interface Client extends GameEngine
|
|||||||
*
|
*
|
||||||
* @return the logged in player
|
* @return the logged in player
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
Player getLocalPlayer();
|
Player getLocalPlayer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -425,6 +426,7 @@ public interface Client extends GameEngine
|
|||||||
*
|
*
|
||||||
* @return the selected tile
|
* @return the selected tile
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
Tile getSelectedSceneTile();
|
Tile getSelectedSceneTile();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -439,6 +441,7 @@ public interface Client extends GameEngine
|
|||||||
*
|
*
|
||||||
* @return the dragged widget, null if not dragging any widget
|
* @return the dragged widget, null if not dragging any widget
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
Widget getDraggedWidget();
|
Widget getDraggedWidget();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -449,6 +452,7 @@ public interface Client extends GameEngine
|
|||||||
*
|
*
|
||||||
* @return the dragged on widget, null if not dragging any widget
|
* @return the dragged on widget, null if not dragging any widget
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
Widget getDraggedOnWidget();
|
Widget getDraggedOnWidget();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -209,12 +209,18 @@ public class GroundMarkerPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
if (hotKeyPressed && event.getOption().equals(WALK_HERE))
|
if (hotKeyPressed && event.getOption().equals(WALK_HERE))
|
||||||
{
|
{
|
||||||
|
final Tile selectedSceneTile = client.getSelectedSceneTile();
|
||||||
|
|
||||||
|
if (selectedSceneTile == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MenuEntry[] menuEntries = client.getMenuEntries();
|
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||||
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1);
|
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1);
|
||||||
|
|
||||||
MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry();
|
MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry();
|
||||||
|
|
||||||
final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, client.getSelectedSceneTile().getLocalLocation());
|
final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, selectedSceneTile.getLocalLocation());
|
||||||
final int regionId = worldPoint.getRegionID();
|
final int regionId = worldPoint.getRegionID();
|
||||||
final GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getRegionX(), worldPoint.getRegionY(), client.getPlane(), config.markerColor());
|
final GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getRegionX(), worldPoint.getRegionY(), client.getPlane(), config.markerColor());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user