]> git.sesse.net Git - vlc/commitdiff
* Don't crash if we cannot retrieve a directory in which to search.
authorDerk-Jan Hartman <hartman@videolan.org>
Tue, 18 Oct 2005 21:53:42 +0000 (21:53 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Tue, 18 Oct 2005 21:53:42 +0000 (21:53 +0000)
src/input/subtitles.c

index fdb4ee7ec126f217494b6c92ecfe8981307b06c7..012c988b5b9de7516cc1d1b64e6984ee37d4098c 100644 (file)
@@ -288,6 +288,8 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path,
     char *psz_fname_original = strdup( psz_name );
     char *psz_fname = psz_fname_original;
 
+    if( psz_fname == NULL ) return NULL;
+
     if( !strncmp( psz_fname, "file://", 7 ) )
     {
         psz_fname += 7;
@@ -312,7 +314,10 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path,
     }
     else
     {
-        f_fname = strdup( psz_fname );
+        /* FIXME: we should check the CWD here */
+        /* f_fname = strdup( psz_fname ); */
+        if( psz_fname_original ) free( psz_fname_original );
+        return NULL;
     }
 
     i_fname_len = strlen( f_fname );
@@ -337,6 +342,9 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path,
         pp_dir_content = NULL;
         i_dir_content = 0;
 
+        if( j < 0 && f_dir == NULL )
+            continue;
+
         /* parse psz_src dir */  
         if( ( i_dir_content = scandir( j < 0 ? f_dir : *subdirs, &pp_dir_content, Filter,
                                 NULL ) ) != -1 )