Browse Source

added a NULL check in `UnloadDirectoryFiles`

Bigfoot71 4 tháng trước cách đây
mục cha
commit
03988d2ce8
1 tập tin đã thay đổi với 5 bổ sung2 xóa
  1. 5 2
      src/rcore.c

+ 5 - 2
src/rcore.c

@@ -2314,9 +2314,12 @@ FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool
 // WARNING: files.count is not reseted to 0 after unloading
 void UnloadDirectoryFiles(FilePathList files)
 {
-    for (unsigned int i = 0; i < files.capacity; i++) RL_FREE(files.paths[i]);
+    if (files.paths != NULL)
+    {
+        for (unsigned int i = 0; i < files.capacity; i++) RL_FREE(files.paths[i]);
 
-    RL_FREE(files.paths);
+        RL_FREE(files.paths);
+    }
 }
 
 // Create directories (including full path requested), returns 0 on success