From cc991888ed7980365794f6f86876932f5cd0b4ed Mon Sep 17 00:00:00 2001 From: Michael Bazzinotti Date: Sat, 22 Aug 2020 22:33:47 -0400 Subject: [PATCH] fixes #139 (assertion on corrupt recent file path) --- pc/shared/App_Settings.cpp | 2 +- pc/shared/App_Settings.h | 2 +- pc/shared/Organization.h | 4 ++-- pc/shared/RecentFiles.cpp | 9 ++++++++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pc/shared/App_Settings.cpp b/pc/shared/App_Settings.cpp index 21188b0e..c6309782 100644 --- a/pc/shared/App_Settings.cpp +++ b/pc/shared/App_Settings.cpp @@ -41,7 +41,7 @@ void App_Settings::save() std::stringstream row; //sprintf( row, "### Preferences file V.%s for MeatBall V.0 #### \n\n", PREF_VERSION ); - row << "### Preferences file V." << PREF_VERSION << " for " << APP_NAME << " V.0 #### \n\n"; + row << "### Preferences file V." << PREF_VERSION << " for " << APP_NAME_VERSION << " #### \n\n"; ofs.write( row.str().c_str(), row.str().length() ); Utility::clearsstream(row); diff --git a/pc/shared/App_Settings.h b/pc/shared/App_Settings.h index f0e4fc0b..8e49dc80 100644 --- a/pc/shared/App_Settings.h +++ b/pc/shared/App_Settings.h @@ -6,7 +6,7 @@ #include "File_System.h" /// Current Settings Revision -#define PREF_VERSION "0.6" +#define PREF_VERSION "0.6.1" /// User Settings File #define USER_PREF_FILE_NAME "Preferences.ini" diff --git a/pc/shared/Organization.h b/pc/shared/Organization.h index a45ba744..97677a14 100644 --- a/pc/shared/Organization.h +++ b/pc/shared/Organization.h @@ -3,8 +3,8 @@ #define COMPANY_NAME "Black Hole Studios" #define APP_NAME "SNES Tracker" #define APP_VER_MAJOR 0 -#define APP_VER_MINOR 1 -#define APP_VER_MICRO 1 +#define APP_VER_MINOR 2 +#define APP_VER_MICRO 0 // concats the 3 version values into a string #define APP_VER_STRING(maj, min, mic) #maj "." #min "." #mic // allows calling the above macro with macro arguments diff --git a/pc/shared/RecentFiles.cpp b/pc/shared/RecentFiles.cpp index 9e54a255..135ac839 100644 --- a/pc/shared/RecentFiles.cpp +++ b/pc/shared/RecentFiles.cpp @@ -162,7 +162,14 @@ void RecentFiles::createDisplayNames() if (paths[i] != NULL) { char *filename = (char *) Utility::getFileName(paths[i]); - assert(filename != NULL); + + // Fixes #139 + if (filename == NULL) + { + paths[i] = NULL; + continue; + } + dnames[i] = (char *) SDL_malloc( sizeof(char) * ( strlen(filename) + 1 + 1) ); strcpy(dnames[i], FONT_BULLETPOINT_STR); strcat(dnames[i], filename);