Patch #17631 by Early Ehlinger
[blender.git] / source / blender / blenlib / intern / dynlib.c
index c4692995f20d4f5151860d6803c2b5216b27ce4c..e7fa3332f435ac27fcc9209fa88bc405101510e8 100644 (file)
@@ -77,12 +77,12 @@ char *PIL_dynlib_get_error_as_string(PILdynlib* lib) {
        int err;
 
        /* if lib is NULL reset the last error code */
+       err= GetLastError();
        if (!lib) {
                SetLastError(ERROR_SUCCESS);
-               return NULL;
+               err = ERROR_SUCCESS;
        }
 
-       err= GetLastError();
        if (err) {
                static char buf[1024];
 
@@ -96,7 +96,7 @@ char *PIL_dynlib_get_error_as_string(PILdynlib* lib) {
                        return buf;
        }
        
-       return NULL;
+       return "unrecognized error";
 }
 
 void PIL_dynlib_close(PILdynlib *lib) {