Skip to content

Commit cd04187

Browse files
authored
Null-check entity UUID in WaypointCache (#6422)
* Add null check for entity UUID in WaypointCache * Remove entity from uuid().toString() * Remove parenthesis after uuid
1 parent 039fda2 commit cd04187

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

core/src/main/java/org/geysermc/geyser/session/cache/waypoint/WaypointCache.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ public void handlePacket(ClientboundTrackedWaypointPacket packet) {
6666
}
6767

6868
public void addEntity(Entity entity) {
69-
GeyserWaypoint waypoint = waypoints.get(entity.uuid().toString());
69+
UUID uuid = entity.uuid();
70+
if (uuid == null) {
71+
return;
72+
}
73+
74+
GeyserWaypoint waypoint = waypoints.get(uuid.toString());
7075
if (waypoint != null) {
7176
// On 1.26.0 and below:
7277
// This will remove the fake player packet previously sent to the client,
@@ -91,7 +96,12 @@ public void addEntity(Entity entity) {
9196
}
9297

9398
public void removeEntity(Entity entity) {
94-
GeyserWaypoint waypoint = waypoints.get(entity.uuid().toString());
99+
UUID uuid = entity.uuid();
100+
if (uuid == null) {
101+
return;
102+
}
103+
104+
GeyserWaypoint waypoint = waypoints.get(uuid.toString());
95105
if (waypoint != null) {
96106
// On 1.26.0 and below:
97107
// This will remove the player packet previously sent to the client,

0 commit comments

Comments
 (0)