Fix a null pointer
Seems to crash the playback thread when leaving while playing. In sync it could crash the entire client. The playback threads gets restarted when rejoining and playing again through. So not the cause for #16 or similar issues.
This commit is contained in:
parent
92726a6566
commit
a219ab46b9
@ -150,7 +150,7 @@ public class SongPlayer implements ClientTickEvents.StartWorldTick {
|
||||
GameMode gameMode = client.interactionManager == null ? null : client.interactionManager.getCurrentGameMode();
|
||||
// In the best case, gameMode would only be queried in sync Ticks, no here
|
||||
if (gameMode == null || !gameMode.isSurvivalLike()) {
|
||||
client.inGameHud.getChatHud().addMessage(Text.translatable(Main.MOD_ID+".player.invalid_game_mode", gameMode.getTranslatableName()).formatted(Formatting.RED));
|
||||
client.inGameHud.getChatHud().addMessage(Text.translatable(Main.MOD_ID+".player.invalid_game_mode", gameMode == null ? "unknown" : gameMode.getTranslatableName()).formatted(Formatting.RED));
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user