From 877a4859d62cc02d35f422ba449181c995c6964b Mon Sep 17 00:00:00 2001 From: Chris Want Date: Fri, 14 Feb 2003 03:24:45 +0000 Subject: Fix to make plugins work on windows (last system error code for the thread wasn't getting reset). Somebody with more windows saavy might want to check that this doesn't break other stuff. --- source/blender/blenlib/intern/dynlib.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source/blender/blenlib/intern/dynlib.c') 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]; -- cgit v1.2.3