SUPERNOVA: Fix use-after-free bug when dying

Since the inventory contains pointers to objects from the rooms, we
need to clear the inventory before we destroy the rooms and not after!
This commit is contained in:
Thierry Crozat 2021-09-07 23:34:45 +01:00
parent de03f549ae
commit c741f733a0

View file

@ -947,6 +947,7 @@ void GameManager::dead(int messageId) {
_vm->paletteFadeOut();
_vm->removeMessage();
_inventory.clear();
destroyRooms();
initRooms();
initState();
@ -955,7 +956,6 @@ void GameManager::dead(int messageId) {
else if (_vm->_MSPart == 2)
changeRoom(AIRPORT);
initGui();
_inventory.clear();
g_system->fillScreen(kColorBlack);
_vm->paletteFadeIn();