1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-26 08:41:13 +02:00

Merge pull request #3750 from IvanSavenko/fix_quest_crash

Fix crash on accessing nullptr quest
This commit is contained in:
Ivan Savenko 2024-04-12 15:25:33 +03:00 committed by GitHub
commit e1581087c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1199,13 +1199,9 @@ void RemoveObject::applyGs(CGameState *gs)
gs->map->quests[quest->quest->qid] = nullptr;
for (auto &player : gs->players)
{
for (auto &q : player.second.quests)
{
if (q.obj == obj)
{
q.obj = nullptr;
}
}
vstd::erase_if(player.second.quests, [obj](const QuestInfo & q){
return q.obj == obj;
});
}
}