extras/ignorecase.c
changeset 1638 1cbecbcf537e
parent 1631 1aec60db9326
--- a/extras/ignorecase.c	Thu Mar 08 12:21:45 2018 -0500
+++ b/extras/ignorecase.c	Fri Mar 09 14:50:37 2018 -0500
@@ -50,18 +50,22 @@
         ptr++;  /* point past dirsep to entry itself. */
     } /* else */
 
-    for (i = rc; *i != NULL; i++)
+    if (rc != NULL)
     {
-        if (PHYSFS_utf8stricmp(*i, ptr) == 0)
+        for (i = rc; *i != NULL; i++)
         {
-            strcpy(ptr, *i); /* found a match. Overwrite with this case. */
-            PHYSFS_freeList(rc);
-            return 1;
-        } /* if */
-    } /* for */
+            if (PHYSFS_utf8stricmp(*i, ptr) == 0)
+            {
+                strcpy(ptr, *i); /* found a match. Overwrite with this case. */
+                PHYSFS_freeList(rc);
+                return 1;
+            } /* if */
+        } /* for */
+
+        PHYSFS_freeList(rc);
+    } /* if */
 
     /* no match at all... */
-    PHYSFS_freeList(rc);
     return 0;
 } /* locateOneElement */