Skip to content

Commit

Permalink
TASK-4911 fixed possible NPE when a player quits the game
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolf2323 committed Dec 18, 2024
1 parent 95c8956 commit aba7acc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<properties>
<!-- project version -->
<revision>0.8.0</revision>
<revision>0.8.1</revision>
<changelist>-SNAPSHOT</changelist>
</properties>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package nl.svenar.powercamera.tracker;

import nl.svenar.powercamera.CameraHandler;
import nl.svenar.powercamera.data.PlayerCameraData;
import org.bukkit.entity.Player;

Expand All @@ -25,6 +26,9 @@ public void handlePlayerJoin(Player player) {
}

public void handlePlayerQuit(Player player) {
cameraDataMap.remove(player.getUniqueId()).getCameraHandler().cancel();
final CameraHandler cameraHandler = cameraDataMap.remove(player.getUniqueId()).getCameraHandler();
if (cameraHandler != null) {
cameraHandler.cancel();
}
}
}

0 comments on commit aba7acc

Please sign in to comment.