Commit ed646f0f authored by hartman's avatar hartman
Browse files

* Don't crash if we cannot retrieve a directory in which to search.

parent 1d135a80
...@@ -288,6 +288,8 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path, ...@@ -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_original = strdup( psz_name );
char *psz_fname = psz_fname_original; char *psz_fname = psz_fname_original;
if( psz_fname == NULL ) return NULL;
if( !strncmp( psz_fname, "file://", 7 ) ) if( !strncmp( psz_fname, "file://", 7 ) )
{ {
psz_fname += 7; psz_fname += 7;
...@@ -312,7 +314,10 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path, ...@@ -312,7 +314,10 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path,
} }
else 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 ); i_fname_len = strlen( f_fname );
...@@ -337,6 +342,9 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path, ...@@ -337,6 +342,9 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path,
pp_dir_content = NULL; pp_dir_content = NULL;
i_dir_content = 0; i_dir_content = 0;
if( j < 0 && f_dir == NULL )
continue;
/* parse psz_src dir */ /* parse psz_src dir */
if( ( i_dir_content = scandir( j < 0 ? f_dir : *subdirs, &pp_dir_content, Filter, if( ( i_dir_content = scandir( j < 0 ? f_dir : *subdirs, &pp_dir_content, Filter,
NULL ) ) != -1 ) NULL ) ) != -1 )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment