win32: dirent: handle errors
[gitweb.git] / compat / mingw.c
index 29f403649f0e3c6d4240fc93e6fa1787a017b9ea..9f8f37f062fb532a2b91490e924f5fb4ea9df0c2 100644 (file)
@@ -1582,7 +1582,7 @@ struct dirent *mingw_readdir(DIR *dir)
        HANDLE handle;
        struct mingw_DIR *mdir = (struct mingw_DIR*)dir;
 
-       if (!dir->dd_handle) {
+       if (!dir || !dir->dd_handle) {
                errno = EBADF; /* No set_errno for mingw */
                return NULL;
        }