patch retro_opendir to handle nullptr and empty-string input

This commit is contained in:
David Walters 2018-04-12 12:44:42 +01:00
parent 872c364f34
commit 801ecb019a

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;