Skip to content

Commit

Permalink
catch NPE when a disconnection occurs early
Browse files Browse the repository at this point in the history
  • Loading branch information
onebeastchris committed Jan 31, 2024
1 parent e4acf7f commit b52af62
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
## GeyserPackSync changelog: Version 2.0-SNAPSHOT

This is a big one!
Bugfix for 2.0: Catch NullPointerException if a disconnection happens unexpectedly

2.0 Changelog:
This release aims to fix all the weird issues where Bedrock players sometimes weren't recognized properly.
Additionally, this release has tons of internal changes to ensure consistent behavior across the bungee and velocity version.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,14 @@ public void handleGeyserLoadResourcePackEvent(SessionLoadResourcePacksEvent even
}

public void handleDisconnectEvent(SessionDisconnectEvent event) {
getLogger().debug(String.format("User %s (%s) disconnected, removing from player pack tracker",
event.connection().name(), event.connection().xuid()));
this.playerPackTracker.remove(event.connection().xuid());
try {
getLogger().debug(String.format("User %s (%s) disconnected, removing from player pack tracker",
event.connection().name(), event.connection().xuid()));
this.playerPackTracker.remove(event.connection().xuid());
} catch (NullPointerException ignored) {
// Can occur when disconnection is due to an error in the connection.
// Since these players aren't in the cache anyway - hopefully - we yeet them
}
}

public void reload() {
Expand Down

0 comments on commit b52af62

Please sign in to comment.