Grasscutters / Grasscutter

A server software reimplementation for a certain anime game.
https://grasscutter.io/
GNU Affero General Public License v3.0
16.29k stars 4.48k forks source link

[Bug] A null pointer error was encountered while trying to shut down the DISPATCH_ONLY server #2532

Open Jimmy32767255 opened 1 month ago

Jimmy32767255 commented 1 month ago

Logs:

2024-10-22T16:13:23Z Command used by server console: stop 2024-10-22T16:13:23Z 正在关闭服务器... 2024-10-22T16:13:23Z 命令发生错误: java.lang.NullPointerException: Cannot invoke "emu.grasscutter.server.game.GameServer.getPlayers()" because the return value of "emu.grasscutter.Grasscutter.getGameServer()" is null at emu.grasscutter.command.commands.StopCommand.execute(StopCommand.java:20) at emu.grasscutter.command.CommandMap.lambda$invoke$0(CommandMap.java:331) at emu.grasscutter.command.CommandMap.invoke(CommandMap.java:335) at emu.grasscutter.Grasscutter.startConsole(Grasscutter.java:351) at emu.grasscutter.Grasscutter.main(Grasscutter.java:187)

Possible cause:

The server needs to kick out all players when it is shut down, so it needs to retrieve a list of players. However, on a server with DISPATCH_ONLY, the game service has never been started, so there is no player list. Therefore, a null pointer error occurs when trying to retrieve it.

Screenshot:

71abe9b0-20bc-4a04-ae11-d5673c7343e7

Firefly5201314 commented 1 month ago

自己修

MLChinoo commented 1 month ago

大神有能力提issue没能力提pr是吗😋