Explorar el Código

Mac Classic platform layer: don't strcmp() a NULL string.

Ryan C. Gordon hace 19 años
padre
commit
31ff24a38f
Se han modificado 1 ficheros con 7 adiciones y 6 borrados
  1. 7 6
      platform/macclassic.c

+ 7 - 6
platform/macclassic.c

@@ -124,15 +124,16 @@ static OSErr oserr(OSErr retval)
 {
     char buf[sizeof (ERR_MACOS_GENERIC) + 32];
     const char *errstr = get_macos_error_string(retval);
-    if (strcmp(errstr, ERR_MACOS_GENERIC) == 0)
+    if (errstr != NULL)
     {
-        sprintf(buf, ERR_MACOS_GENERIC, (int) retval);
-        errstr = buf;
-    } /* if */
+        if (strcmp(errstr, ERR_MACOS_GENERIC) == 0)
+        {
+            sprintf(buf, ERR_MACOS_GENERIC, (int) retval);
+            errstr = buf;
+        } /* if */
 
-    if (errstr != NULL)
         __PHYSFS_setError(errstr);
-
+    } /* if */
     return(retval);
 } /* oserr */