Skip to content

Fix|NullPointerException-in-PlayerRadarProvider.update()#29

Open
darkace1998 wants to merge 4 commits intoninesliced:mainfrom
darkace1998:fix|NullPointerException-in-PlayerRadarProvider.update()
Open

Fix|NullPointerException-in-PlayerRadarProvider.update()#29
darkace1998 wants to merge 4 commits intoninesliced:mainfrom
darkace1998:fix|NullPointerException-in-PlayerRadarProvider.update()

Conversation

@darkace1998
Copy link
Copy Markdown
Contributor

Problem

Two NullPointerException crash paths existed in UserMarkerContextMenuProvider.update() during marker rendering:

getPerWorldData() could return null (e.g. player has no saved world data yet), and the result was immediately dereferenced in a for-each loop.
getResource() could return null (e.g. chunk store not yet initialized), and was similarly used without a guard.
In both cases, getUserMapMarkers() itself could also return null, which was not guarded against.

Any of these conditions would crash the map update for that player, potentially affecting all players in the world.
Changes

Added a null check for perWorldData before iterating personal waypoint markers.
Added a null check for the getUserMapMarkers() return value on both the personal and global waypoints paths.
Added a null check for worldMarkersResource before iterating global waypoint markers.
Updated class-level and method-level Javadoc to accurately reflect that both Edit and Teleport context menu items are added (not just Edit).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant