aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-09-29 10:07:40 -0500
committerTed Gould <ted@gould.cx>2011-09-29 10:07:40 -0500
commit6e9eb952ae9f2703c5e06b62ede0ef4b1ddfda3f (patch)
tree3c0718a3ce8ca09d80a547e8386ece72593d2dac
parentb1bbe3c1e2af12078d9a77d55e6f87a67b3f02c3 (diff)
parent43a5a69eac9dcad57a13a0b14a4b3de50b75e2f8 (diff)
downloadayatana-indicator-datetime-6e9eb952ae9f2703c5e06b62ede0ef4b1ddfda3f.tar.gz
ayatana-indicator-datetime-6e9eb952ae9f2703c5e06b62ede0ef4b1ddfda3f.tar.bz2
ayatana-indicator-datetime-6e9eb952ae9f2703c5e06b62ede0ef4b1ddfda3f.zip
Protect setting or unseting the env if we don't have it already.
-rw-r--r--src/utils.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/utils.c b/src/utils.c
index 73c8ab2..e6de92a 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -161,7 +161,8 @@ T_(const char *msg)
char *time_locale = g_strdup(setlocale(LC_TIME, NULL));
char *language = g_strdup(g_getenv("LANGUAGE"));
char *rv;
- g_unsetenv("LANGUAGE");
+ if (language)
+ g_unsetenv("LANGUAGE");
setlocale(LC_MESSAGES, time_locale);
/* Get the LC_TIME version */
@@ -169,7 +170,8 @@ T_(const char *msg)
/* Put everything back the way it was */
setlocale(LC_MESSAGES, message_locale);
- g_setenv("LANGUAGE", language, TRUE);
+ if (language)
+ g_setenv("LANGUAGE", language, TRUE);
g_free(message_locale);
g_free(time_locale);
g_free(language);