SaveState: Prevent edge case on old save state.

If we load an old save state and it errors, could crash.
This commit is contained in:
Unknown W. Brackets 2020-06-29 19:40:54 -07:00
parent 20dd7db351
commit e6b42f3921

View File

@ -361,6 +361,8 @@ public:
p.Do(fontLibID_);
if (s >= 2) {
p.Do(errorCodePtr_);
} else {
errorCodePtr_ = 0;
}
}
void run(MipsCall &call) override;
@ -721,7 +723,8 @@ void PostAllocCallback::run(MipsCall &call) {
u32 v0 = currentMIPS->r[MIPS_REG_V0];
if (v0 == 0) {
// TODO: Who deletes fontLib?
Memory::Write_U32(ERROR_FONT_OUT_OF_MEMORY, errorCodePtr_);
if (errorCodePtr_)
Memory::Write_U32(ERROR_FONT_OUT_OF_MEMORY, errorCodePtr_);
call.setReturnValue(0);
} else {
FontLib *fontLib = fontLibList[fontLibID_];