From 711335e20534d6eb3dfdf530db34a3d0a910db70 Mon Sep 17 00:00:00 2001 From: Stefan Neis Date: Sun, 15 Jun 2008 16:42:20 +0000 Subject: [PATCH] Fixed wxDoSetEnv (ticket # 9588). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54241 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/os2/utils.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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; -- 2.45.2