changeset 1192:16413a86172c trunk

fix for crash when the file pointed in a cuesheet does not exist. closes #978.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Thu, 21 Jun 2007 21:00:35 +0900
parents 1cb26b6f7ba0
children 8a2a9ec122f0
files src/cue/cuesheet.c
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/cue/cuesheet.c	Thu Jun 21 11:37:29 2007 +0100
+++ b/src/cue/cuesheet.c	Thu Jun 21 21:00:35 2007 +0900
@@ -259,9 +259,15 @@
 
 	out = bmp_title_input_new();
 
-	out->file_path = g_strdup(phys_tuple->file_path);	
-	out->file_name = g_strdup(phys_tuple->file_name);
-	out->file_ext = g_strdup(phys_tuple->file_ext);
+    if(!phys_tuple)
+        return out;
+
+    if(phys_tuple->file_path)
+        out->file_path = g_strdup(phys_tuple->file_path);
+    if(phys_tuple->file_name)
+        out->file_name = g_strdup(phys_tuple->file_name);
+    if(phys_tuple->file_ext)
+        out->file_ext = g_strdup(phys_tuple->file_ext);
 	out->length = phys_tuple->length;
 
 	bmp_title_input_free(phys_tuple);
@@ -441,7 +447,7 @@
 	cur_cue_track = track;
 	cache_cue_file(path2);
 
-    if (cue_file == NULL)
+    if (cue_file == NULL || !g_file_test(cue_file, G_FILE_TEST_EXISTS))
         return;
 
 	real_ip_plugin = input_check_file(cue_file, FALSE);