diff options
Diffstat (limited to 'mg_image_provider.c')
-rw-r--r-- | mg_image_provider.c | 7 |
1 files changed, 5 insertions, 2 deletions
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 ) ); } } |