Fixing null pointer exception

This commit is contained in:
Sergiotarxz 2023-04-03 19:31:39 +02:00
parent 4dfdd41c08
commit 688fc30b6f
2 changed files with 3 additions and 1 deletions

View File

@ -35,7 +35,6 @@ msCoreControllerLoadGame (const unsigned char *rom, size_t rom_len,
if (!core) {
ms_last_error = "This rom does not appear to be a GBA or GB/C one";
file_rom->close(file_rom);
file_state->close(file_rom);
goto loadGameReturn;
}
core->init(core);

View File

@ -101,6 +101,9 @@ msPacketHelloHandle(const struct msPacket *packet, struct msPacketHello *hello,
}
printf("Loading game and save for client_fd %d\n", data->clientFd);
data->coreController = msCoreControllerLoadGame(hello->rom, hello->sizeRom, hello->savestate, hello->sizeSavestate, data);
if (!data->coreController) {
goto return_ms_packet_hello_handle;
}
msCoreControllerSetFrameCallback(data->coreController, &msThreadCallbackSetFrame);
msCoreControllerSetStartCallback(data->coreController, &msThreadCallbackStart);
msCoreControllerThreadStart(data->coreController);