diff options
-rw-r--r-- | source/blender/blenlib/intern/dynlib.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/dynlib.c b/source/blender/blenlib/intern/dynlib.c index b1d19f46c38..89c21a9af55 100644 --- a/source/blender/blenlib/intern/dynlib.c +++ b/source/blender/blenlib/intern/dynlib.c @@ -67,8 +67,15 @@ void *PIL_dynlib_find_symbol(PILdynlib* lib, char *symname) { } char *PIL_dynlib_get_error_as_string(PILdynlib* lib) { - int err= GetLastError(); + int err; + /* if lib is NULL reset the last error code */ + if (!lib) { + SetLastError(ERROR_SUCCESS); + return NULL; + } + + err= GetLastError(); if (err) { static char buf[1024]; |