maptool icon indicating copy to clipboard operation
maptool copied to clipboard

[Bug]: Starting a new campaign while token move in progress produces NPE

Open Phergus opened this issue 3 years ago • 0 comments

Describe the Bug

If a token move is in progress when a new campaign is started produces a NPE.

java.lang.NullPointerException: Cannot invoke "net.rptools.maptool.model.Zone.putToken(net.rptools.maptool.model.Token)" because the return value of "net.rptools.maptool.model.Campaign.getZone(net.rptools.maptool.model.GUID)" is null
	at net.rptools.maptool.client.ServerCommandClientImpl.putToken(ServerCommandClientImpl.java:173)
	at net.rptools.maptool.client.ui.zone.ZoneRenderer.commitMoveSelectionSet(ZoneRenderer.java:522)
	at net.rptools.maptool.client.tool.PointerTool.stopTokenDrag(PointerTool.java:251)
	at net.rptools.maptool.client.ui.MapToolFrame.stopTokenDrag(MapToolFrame.java:1540)
	at net.rptools.maptool.client.ui.MapToolFrame.setCurrentZoneRenderer(MapToolFrame.java:1566)
	at net.rptools.maptool.client.AppActions$55.executeAction(AppActions.java:2023)
	at net.rptools.maptool.client.AppActions$ClientAction.execute(AppActions.java:3456)
...

To Reproduce

  1. Start MT.
  2. Drop a token on map.
  3. Move token using cursor keys 1 or more times but don't terminate move.
  4. Select File -> New Campaign and select Yes to Discard current campaign prompt.
  5. See NPE.

Expected Behaviour

No error.

Screenshots

No response

MapTool Info

Current dev branch

Desktop

Windows 10

Additional Context

N/A

Phergus avatar Aug 15 '22 15:08 Phergus