Skip to content

Commit

Permalink
Don't show an error if error code is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Varg committed Sep 28, 2024
1 parent b5a589f commit bc1c220
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/lib/qsp-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@ export class QspAPIImpl implements QspAPI {
const ptr = allocErrorInfoPointer(this.module);
this.module._getLastError(ptr);
const error = readError(this.module, ptr);
this.emit('error', error);
if (error.errorCode > 0)
this.emit('error', error);
this.module._free(ptr);
};

Expand Down
Binary file modified src/qsplib/public/qsp-engine-debug.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion src/qsplib/public/qsp-engine-debug.wasm.map

Large diffs are not rendered by default.

Binary file modified src/qsplib/public/qsp-engine.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion src/qsplib/src/qsp_wasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void *saveGameData(int *realSize)
if (!fileSize)
{
free(fileData);
return fileData;
return 0;
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/variables.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ $glob_test = $test
expect(api.readVariable('$glob_test')).toBe("value");
});

test('global variables get restored if $ONGSAVE calls goto', () => {
test('global variables get restored if ONGSAVE calls goto', () => {
const onSaveGame = vi.fn((_, callback) => { api.saveGame(); callback(); });
api.on('save_game', onSaveGame);

Expand Down

0 comments on commit bc1c220

Please sign in to comment.