Skip to content

Instantly share code, notes, and snippets.

Created February 10, 2014 00:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/8908390 to your computer and use it in GitHub Desktop.
Save anonymous/8908390 to your computer and use it in GitHub Desktop.
diff --git a/gtk/src/gtk_file.cpp b/gtk/src/gtk_file.cpp
index 0610d43..9e95f28 100644
--- a/gtk/src/gtk_file.cpp
+++ b/gtk/src/gtk_file.cpp
@@ -470,8 +470,10 @@ S9xOpenROMDialog (void)
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
directory =
gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dialog));
- strncpy (gui_config->last_directory, directory, PATH_MAX);
- g_free (directory);
+ if (directory) {
+ strncpy (gui_config->last_directory, directory, PATH_MAX);
+ g_free (directory);
+ }
}
else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment