Merge pull request #6563 from hiddenasbestos/retro_opendir

patch retro_opendir to handle nullptr and empty-string input
This commit is contained in:
Twinaphex 2018-04-12 16:38:51 +02:00 committed by GitHub
commit c5c41efc0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -108,9 +108,13 @@ struct RDIR *retro_opendir(const char *name)
#endif
struct RDIR *rdir = (struct RDIR*)calloc(1, sizeof(*rdir));
if (!rdir)
if (!rdir||!name)
return NULL;
/* Handle empty string as current dir */
if (*name==0)
name=".";
#if defined(_WIN32)
(void)path_wide;
(void)path_local;