physfs.c
changeset 272 470430943851
parent 242 3143cfd544a6
child 314 a156f6155e3c
--- a/physfs.c	Sat Jun 08 08:45:45 2002 +0000
+++ b/physfs.c	Sat Jun 08 08:50:00 2002 +0000
@@ -111,7 +111,7 @@
     ErrMsg *i;
     PHYSFS_uint64 tid;
 
-    if (initialized)
+    if (errorLock != NULL)
         __PHYSFS_platformGrabMutex(errorLock);
 
     if (errorMessages != NULL)
@@ -122,13 +122,14 @@
         {
             if (i->tid == tid)
             {
-                __PHYSFS_platformReleaseMutex(errorLock);
+                if (errorLock != NULL)
+                    __PHYSFS_platformReleaseMutex(errorLock);
                 return(i);
             } /* if */
         } /* for */
     } /* if */
 
-    if (initialized)
+    if (errorLock != NULL)
         __PHYSFS_platformReleaseMutex(errorLock);
 
     return(NULL);   /* no error available. */
@@ -153,10 +154,14 @@
         memset((void *) err, '\0', sizeof (ErrMsg));
         err->tid = __PHYSFS_platformGetThreadID();
 
-        __PHYSFS_platformGrabMutex(errorLock);
+        if (errorLock != NULL)
+            __PHYSFS_platformGrabMutex(errorLock);
+
         err->next = errorMessages;
         errorMessages = err;
-        __PHYSFS_platformReleaseMutex(errorLock);
+
+        if (errorLock != NULL)
+            __PHYSFS_platformReleaseMutex(errorLock);
     } /* if */
 
     err->errorAvailable = 1;
@@ -188,6 +193,8 @@
         next = i->next;
         free(i);
     } /* for */
+
+    errorMessages = NULL;
 } /* freeErrorMessages */