From a00f1fee3da1fd3e2bb10b73dbf4589e143b570e Mon Sep 17 00:00:00 2001 From: Fedja Beader Date: Fri, 11 Oct 2024 22:49:43 +0000 Subject: Fix switchmap during switch character crash (@toevent) use @toevent, then switch character (and stay on character screen). Thread 1 "manaplus" received signal SIGSEGV, Segmentation fault. 0x.. in Game::getCurrentMap (this=) at ./game.h:108 108 { return mCurrentMap; } (gdb) bt 0x.. in Game::getCurrentMap (this=) at ./game.h:108 Ea::PlayerRecv::processMapMask (msg=...) at net/ea/playerrecv.cpp:242 **** mana/plus!108 --- src/net/ea/playerrecv.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/net/ea/playerrecv.cpp b/src/net/ea/playerrecv.cpp index b0b9bab70..b4bbc9ce4 100644 --- a/src/net/ea/playerrecv.cpp +++ b/src/net/ea/playerrecv.cpp @@ -239,7 +239,12 @@ void PlayerRecv::processMapMask(Net::MessageIn &msg) { const int mask = msg.readInt32("mask"); msg.readInt32("unused"); - Map *const map = Game::instance()->getCurrentMap(); + + const Game *const game = Game::instance(); + if (game == nullptr) + return; + + Map *const map = game->getCurrentMap(); if (map != nullptr) map->setMask(mask); } -- cgit v1.2.3-70-g09d2