diff options
author | Wolfgang Rohdewald <wolfgang@rohdewald.de> | 2009-01-11 20:28:33 +0100 |
---|---|---|
committer | Wolfgang Rohdewald <wolfgang@rohdewald.de> | 2009-01-11 20:28:33 +0100 |
commit | c309e7cd8214b9eec92a8011ed2ef777fd81366a (patch) | |
tree | 832fad63f699da90128d28672e6dd066c74e6a0a | |
parent | 45ccb381fdc28e4a33f8494d6352b64963d30c7b (diff) | |
download | vdr-plugin-muggle-c309e7cd8214b9eec92a8011ed2ef777fd81366a.tar.gz vdr-plugin-muggle-c309e7cd8214b9eec92a8011ed2ef777fd81366a.tar.bz2 |
load images: fix buggy error handling (reported in vdr-portal.de by stevie101)
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | mg_image_provider.c | 7 |
2 files changed, 6 insertions, 2 deletions
@@ -387,3 +387,4 @@ Balke. to choose among them. - Lyrics: rewrite the shell script muggle_getlyrics in python and talk directly to the Googlyrics2 python code +- load images: fix buggy error handling (reported in vdr-portal.de by stevie101) diff --git a/mg_image_provider.c b/mg_image_provider.c index 00a5b16..33d53bf 100644 --- a/mg_image_provider.c +++ b/mg_image_provider.c @@ -391,16 +391,19 @@ void mgMpgImageProvider::Action() { void mgImageProvider::fillImageList( string dir ) { // obtain all .png, .jpg in dir and gather them in m_image_list - struct dirent **files; + struct dirent **files = 0; int count = scandir( dir.c_str(), &files, picture_select, alphasort ); - if( count ) { + if( count>0 ) { for ( int i=0; i < count; i++ ) { string fname = dir + "/" + string( files[i]->d_name ); m_image_list.push_back( fname ); free( files[i] ); } free( files ); + } else if (count<0) { + mgDebug( 1, "Cannot scan directory %s: %s", + dir.c_str(), strerror( errno ) ); } } |