From b460d76698e72d805bb7443e6ac2e7e011cd32b2 Mon Sep 17 00:00:00 2001 From: klapeto Date: Fri, 28 Apr 2017 15:50:23 +0300 Subject: [PATCH] Fixed segmentation faults caused by NULL assignments to std::strings --- .gitignore | 6 ++++++ desmume/src/NDSSystem.cpp | 14 +++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 064cf7666..1ac096f48 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,9 @@ xcuserdata/ *.ipa *.dSYM.zip *.dSYM + +## Eclipse CDT generated files +/.autotools +/.cproject +/config.log +/.project diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index 667d02744..3b8129d89 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -658,8 +658,16 @@ struct LastRom { int NDS_LoadROM(const char *filename, const char *physicalName, const char *logicalFilename) { lastRom.filename = filename; - lastRom.physicalName = physicalName; - lastRom.logicalFilename = logicalFilename; + + if (physicalName != NULL ) + { + lastRom.physicalName = physicalName; + } + + if (logicalFilename != NULL) + { + lastRom.logicalFilename = logicalFilename; + } int ret; char buf[MAX_PATH]; @@ -3137,4 +3145,4 @@ void TCommonSettings::GameHacks::apply() void TCommonSettings::GameHacks::clear() { memset(&flags,0,sizeof(flags)); -} \ No newline at end of file +}