summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lolcat.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lolcat.c b/lolcat.c
index a7fc7c3..5c62baf 100644
--- a/lolcat.c
+++ b/lolcat.c
@@ -138,7 +138,8 @@ int main(int argc, char** argv)
inputs_end = inputs + 1;
}
- if (force_locale && !strstr(getenv("LANG"), "UTF-8"))
+ char* env_lang = getenv("LANG");
+ if (force_locale && env_lang && !strstr(env_lang, "UTF-8"))
setlocale(LC_ALL, "C.UTF-8");
else
setlocale(LC_ALL, "");