mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-12 12:24:35 +01:00
Fix null pointer error when logging into a new account
This commit is contained in:
@@ -122,8 +122,7 @@ public class GameSession {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: We should cache players in case multiple sessions try to login to the
|
// Note: We should cache players in case multiple sessions try to login to the same player at the time
|
||||||
// same player at the time
|
|
||||||
// Get player by account
|
// Get player by account
|
||||||
var player = Nebula.getGameContext().getPlayerModule().loadPlayer(account);
|
var player = Nebula.getGameContext().getPlayerModule().loadPlayer(account);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package emu.nebula.server.handlers;
|
package emu.nebula.server.handlers;
|
||||||
|
|
||||||
import emu.nebula.Nebula;
|
import emu.nebula.Nebula;
|
||||||
import emu.nebula.game.player.Player;
|
|
||||||
import emu.nebula.game.player.PlayerErrorCode;
|
import emu.nebula.game.player.PlayerErrorCode;
|
||||||
import emu.nebula.net.GameSession;
|
import emu.nebula.net.GameSession;
|
||||||
import emu.nebula.net.HandlerId;
|
import emu.nebula.net.HandlerId;
|
||||||
@@ -31,7 +30,6 @@ public class HandlerPlayerLoginReq extends NetHandler {
|
|||||||
loginToken = req.getOfficial().getToken();
|
loginToken = req.getOfficial().getToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var banModule = Nebula.getGameContext().getBanModule();
|
var banModule = Nebula.getGameContext().getBanModule();
|
||||||
|
|
||||||
// Check IP ban
|
// Check IP ban
|
||||||
@@ -48,9 +46,8 @@ public class HandlerPlayerLoginReq extends NetHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check player ban
|
// Check player ban
|
||||||
int playerUid = session.getPlayer().getUid();
|
if (session.getPlayer() != null && banModule.isPlayerBanned(session.getPlayer().getUid())) {
|
||||||
if (banModule.isPlayerBanned(playerUid)) {
|
var banInfo = banModule.getPlayerBanInfo(session.getPlayer().getUid());
|
||||||
var banInfo = banModule.getPlayerBanInfo(playerUid);
|
|
||||||
return session.encodeMsg(NetMsgId.player_login_failed_ack, banInfo.toProto());
|
return session.encodeMsg(NetMsgId.player_login_failed_ack, banInfo.toProto());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user