From ceb611e29c7e9cabd54e370317eaf4df17441b39 Mon Sep 17 00:00:00 2001 From: Rafael Caetano Date: Thu, 27 Jun 2024 19:34:08 +0100 Subject: [PATCH] Fix crash when loading a ROM with slot 2 set to load a GBA ROM but no GBA ROM was provided --- app/src/main/cpp/MelonDSAndroidJNI.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/MelonDSAndroidJNI.cpp b/app/src/main/cpp/MelonDSAndroidJNI.cpp index c179adcd..c1d1c291 100644 --- a/app/src/main/cpp/MelonDSAndroidJNI.cpp +++ b/app/src/main/cpp/MelonDSAndroidJNI.cpp @@ -479,11 +479,11 @@ Java_me_magnum_melonds_MelonEmulator_updateEmulatorConfiguration(JNIEnv* env, jo MelonDSAndroid::RomGbaSlotConfig* buildGbaSlotConfig(GbaSlotType slotType, const char* romPath, const char* savePath) { - if (slotType == GbaSlotType::GBA_ROM) + if (slotType == GbaSlotType::GBA_ROM && romPath != nullptr) { MelonDSAndroid::RomGbaSlotConfigGbaRom* gbaSlotConfigGbaRom = new MelonDSAndroid::RomGbaSlotConfigGbaRom { .romPath = std::string(romPath), - .savePath = std::string(savePath) + .savePath = savePath ? std::string(savePath) : "", }; return (MelonDSAndroid::RomGbaSlotConfig*) gbaSlotConfigGbaRom; }