aboutsummaryrefslogtreecommitdiff
path: root/games/snes9x/snes9x-fix-crash.patch
blob: 95ed192e0db42af628c951d1e08f94a8ad378b20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From 6d74746342a73cf65db215f4fdecdfb0cae66792 Mon Sep 17 00:00:00 2001
From: Brandon Wright <bearoso@gmail.com>
Date: Mon, 10 Feb 2014 16:28:05 -0600
Subject: [PATCH] Fix bug caused by virtual directories.

---
 gtk/src/gtk_file.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gtk/src/gtk_file.cpp b/gtk/src/gtk_file.cpp
index a0df75d..9c0e000 100644
--- a/gtk/src/gtk_file.cpp
+++ b/gtk/src/gtk_file.cpp
@@ -465,8 +465,11 @@ 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
-- 
1.9.3