diff options
author | Fedja Beader <fedja@protonmail.ch> | 2024-08-21 18:14:33 +0000 |
---|---|---|
committer | Fedja Beader <fedja@protonmail.ch> | 2024-08-21 18:14:33 +0000 |
commit | 2f932e192e18a5efcd12b600337726b534f759a3 (patch) | |
tree | 984e98ffc7c4656e02d9cd26ebe836b23cb83e27 | |
parent | 59b7980cce1e171a8213390e81b8538a3661ada7 (diff) | |
download | mv-2f932e192e18a5efcd12b600337726b534f759a3.tar.gz mv-2f932e192e18a5efcd12b600337726b534f759a3.tar.bz2 mv-2f932e192e18a5efcd12b600337726b534f759a3.tar.xz mv-2f932e192e18a5efcd12b600337726b534f759a3.zip |
Fix skill fail packet handling causing nullptr crash when switching characters
How to reproduce: spam emote then quickly switch char
Thread 1 "manaplus" received signal SIGSEGV, Segmentation fault.
SkillDialog::getSkill (this=0x0, id=id@entry=1) at gui/windows/skilldialog.cpp:805
0 SkillDialog::getSkill (this=0x0, id=id@entry=1) at gui/windows/skilldialog.cpp:805
1 EAthena::SkillRecv::processSkillFailed (msg=...) at net/eathena/skillrecv.cpp:302
...
****
mana/plus!92
-rw-r--r-- | src/net/eathena/skillrecv.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/net/eathena/skillrecv.cpp b/src/net/eathena/skillrecv.cpp index 3f3e8efb1..dc24b15b4 100644 --- a/src/net/eathena/skillrecv.cpp +++ b/src/net/eathena/skillrecv.cpp @@ -298,7 +298,9 @@ void SkillRecv::processSkillFailed(Net::MessageIn &msg) localPlayer->stopAdvert(); } - const SkillInfo *const info = skillDialog->getSkill(bskill); + const SkillInfo *const info = skillDialog + ? skillDialog->getSkill(bskill) + : nullptr; if (info != nullptr) { txt = info->errorText; @@ -311,7 +313,9 @@ void SkillRecv::processSkillFailed(Net::MessageIn &msg) } else { - const SkillInfo *const info = skillDialog->getSkill(skillId); + const SkillInfo *const info = skillDialog + ? skillDialog->getSkill(skillId) + : nullptr; if (info != nullptr) { txt = info->errorText + "."; |