Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GRIM: Fix unknown key error when loading savegame #2790

Open
wants to merge 1 commit into
base: master
from

Conversation

@criezy
Copy link
Member

@criezy criezy commented Feb 21, 2021

A user reported a crash with Unknown key! error when trying to load a save game in MI4 today on IRC/Discord.
@henke37 suggested that the likely culprit was the code changed in this pull request.

I don't have the game, and the demo doesn't let me save games. So I am unable to test this. This is why I am proposing this as a pull request so that developers who know the engine or can at least test it can validate the change.

_map.erase(id);
T *t = nullptr;
if (_map.tryGetVal(id, t))
_map.erase(id);
if (!t) {

This comment has been minimized.

@henke37

henke37 Feb 21, 2021
Contributor

I would've probably reused the existing if statement. It's clear from context that it's the same condition.

This comment has been minimized.

@criezy

criezy Feb 21, 2021
Author Member

I didn't know if I could assume that _map does not contain null pointers. But if that is a safe assumption we could indeed use an else statement here.

This comment has been minimized.

@henke37

henke37 Feb 21, 2021
Contributor

It calls a member function only a few lines bellow, no null pointers could've been stored legitimately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants