diff options
author | Fedja Beader <fedja@protonmail.ch> | 2024-10-11 22:49:43 +0000 |
---|---|---|
committer | Fedja Beader <fedja@protonmail.ch> | 2024-10-11 22:49:43 +0000 |
commit | a00f1fee3da1fd3e2bb10b73dbf4589e143b570e (patch) | |
tree | 076a051cd5300cb40889336e01506d222e3bf49d | |
parent | f9e62010fb73efb22476c64fe13947b0437b7633 (diff) | |
download | plus-a00f1fee3da1fd3e2bb10b73dbf4589e143b570e.tar.gz plus-a00f1fee3da1fd3e2bb10b73dbf4589e143b570e.tar.bz2 plus-a00f1fee3da1fd3e2bb10b73dbf4589e143b570e.tar.xz plus-a00f1fee3da1fd3e2bb10b73dbf4589e143b570e.zip |
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=<optimized out>) at ./game.h:108
108 { return mCurrentMap; }
(gdb) bt
0x.. in Game::getCurrentMap (this=<optimized out>) at ./game.h:108
Ea::PlayerRecv::processMapMask (msg=...) at net/ea/playerrecv.cpp:242
****
mana/plus!108
-rw-r--r-- | src/net/ea/playerrecv.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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); } |