Fix null pointer error when logging into a new account

This commit is contained in:
Melledy
2025-12-11 23:25:49 -08:00
parent 5668ba9cea
commit 11ea526a35
2 changed files with 3 additions and 7 deletions

View File

@@ -122,8 +122,7 @@ public class GameSession {
return false;
}
// Note: We should cache players in case multiple sessions try to login to the
// same player at the time
// Note: We should cache players in case multiple sessions try to login to the same player at the time
// Get player by account
var player = Nebula.getGameContext().getPlayerModule().loadPlayer(account);

View File

@@ -1,7 +1,6 @@
package emu.nebula.server.handlers;
import emu.nebula.Nebula;
import emu.nebula.game.player.Player;
import emu.nebula.game.player.PlayerErrorCode;
import emu.nebula.net.GameSession;
import emu.nebula.net.HandlerId;
@@ -31,7 +30,6 @@ public class HandlerPlayerLoginReq extends NetHandler {
loginToken = req.getOfficial().getToken();
}
var banModule = Nebula.getGameContext().getBanModule();
// Check IP ban
@@ -48,9 +46,8 @@ public class HandlerPlayerLoginReq extends NetHandler {
}
// Check player ban
int playerUid = session.getPlayer().getUid();
if (banModule.isPlayerBanned(playerUid)) {
var banInfo = banModule.getPlayerBanInfo(playerUid);
if (session.getPlayer() != null && banModule.isPlayerBanned(session.getPlayer().getUid())) {
var banInfo = banModule.getPlayerBanInfo(session.getPlayer().getUid());
return session.encodeMsg(NetMsgId.player_login_failed_ack, banInfo.toProto());
}