mGUI: Fix crash if last loaded ROM directory disappears (fixes #1466)
Vicki Pfau vi@endrift.com
Mon, 24 Jun 2019 13:15:37 -0700
2 files changed,
7 insertions(+),
2 deletions(-)
M
CHANGES
→
CHANGES
@@ -39,6 +39,7 @@ - Qt: Fix menu bar staying hidden in full screen (fixes mgba.io/i/317)
- GB SIO: Fix lockstep failing games aren't reloaded - Core: Fix crash when exiting game with cheats loaded - GBA Cheats: Fix PARv3 Thumb hooks + - mGUI: Fix crash if last loaded ROM directory disappears (fixes mgba.io/i/1466) Misc: - GBA Savedata: EEPROM performance fixes - GBA Savedata: Automatically map 1Mbit Flash files as 1Mbit Flash
M
src/feature/gui/gui-runner.c
→
src/feature/gui/gui-runner.c
@@ -212,8 +212,12 @@ mLogSetDefaultLogger(&logger.d);
const char* lastPath = mCoreConfigGetValue(&runner->config, "lastDirectory"); if (lastPath) { - strncpy(runner->params.currentPath, lastPath, PATH_MAX - 1); - runner->params.currentPath[PATH_MAX - 1] = '\0'; + struct VDir* dir = VDirOpen(lastPath); + if (dir) { + dir->close(dir); + strncpy(runner->params.currentPath, lastPath, PATH_MAX - 1); + runner->params.currentPath[PATH_MAX - 1] = '\0'; + } } #ifndef DISABLE_THREADING