comparison src/cue/cuesheet.c @ 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 07914886d6aa
children 0d5b0f861bf0
comparison
equal deleted inserted replaced
1191:1cb26b6f7ba0 1192:16413a86172c
257 else 257 else
258 phys_tuple = input_get_song_tuple(cue_file); 258 phys_tuple = input_get_song_tuple(cue_file);
259 259
260 out = bmp_title_input_new(); 260 out = bmp_title_input_new();
261 261
262 out->file_path = g_strdup(phys_tuple->file_path); 262 if(!phys_tuple)
263 out->file_name = g_strdup(phys_tuple->file_name); 263 return out;
264 out->file_ext = g_strdup(phys_tuple->file_ext); 264
265 if(phys_tuple->file_path)
266 out->file_path = g_strdup(phys_tuple->file_path);
267 if(phys_tuple->file_name)
268 out->file_name = g_strdup(phys_tuple->file_name);
269 if(phys_tuple->file_ext)
270 out->file_ext = g_strdup(phys_tuple->file_ext);
265 out->length = phys_tuple->length; 271 out->length = phys_tuple->length;
266 272
267 bmp_title_input_free(phys_tuple); 273 bmp_title_input_free(phys_tuple);
268 274
269 out->track_name = g_strdup(cue_tracks[track].title); 275 out->track_name = g_strdup(cue_tracks[track].title);
439 track = atoi(_path); 445 track = atoi(_path);
440 } 446 }
441 cur_cue_track = track; 447 cur_cue_track = track;
442 cache_cue_file(path2); 448 cache_cue_file(path2);
443 449
444 if (cue_file == NULL) 450 if (cue_file == NULL || !g_file_test(cue_file, G_FILE_TEST_EXISTS))
445 return; 451 return;
446 452
447 real_ip_plugin = input_check_file(cue_file, FALSE); 453 real_ip_plugin = input_check_file(cue_file, FALSE);
448 454
449 if (real_ip_plugin != NULL) 455 if (real_ip_plugin != NULL)