From: Stefan Neis Date: Sun, 15 Jun 2008 16:42:20 +0000 (+0000) Subject: Fixed wxDoSetEnv (ticket # 9588). X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/711335e20534d6eb3dfdf530db34a3d0a910db70 Fixed wxDoSetEnv (ticket # 9588). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54241 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/os2/utils.cpp b/src/os2/utils.cpp index e3bc440f27..14d2c6b3e1 100644 --- a/src/os2/utils.cpp +++ b/src/os2/utils.cpp @@ -241,6 +241,14 @@ bool wxGetEnv(const wxString& var, wxString *value) static bool wxDoSetEnv(const wxString& variable, const char *value) { #if defined(HAVE_SETENV) + if ( !value ) + { +#ifdef HAVE_UNSETENV + return unsetenv(variable.mb_str()) == 0; +#else + value = _T(""); // mustn't pass NULL to setenv() +#endif + } return setenv(variable.mb_str(), value, 1 /* overwrite */) == 0; #elif defined(HAVE_PUTENV) wxString s = variable;