utils: fix unsetting timezone

This commit is contained in:
Dirk-Jan C. Binnema 2022-05-18 01:12:20 +03:00
parent b03590cca8
commit 2fd133761f
1 changed files with 4 additions and 1 deletions

View File

@ -637,7 +637,10 @@ Mu::timezone_available(const std::string& tz)
bool have_tz = g_strcmp0(g_time_zone_get_identifier(tzone), tz.c_str()) == 0;
g_time_zone_unref (tzone);
g_setenv("TZ", old_tz, TRUE);
if (old_tz)
g_setenv("TZ", old_tz, TRUE);
else
g_unsetenv("TZ");
return have_tz;
}