diff options
author | Edgar Fouillet <fouillet.edgar@outlook.fr> | 2019-09-25 18:36:54 +0200 |
---|---|---|
committer | jaseg <githubaccount@jaseg.net> | 2019-11-10 16:36:39 +0100 |
commit | 6e1caef075b973999cda4cac5b3fb40b6a4b5408 (patch) | |
tree | fc2a9f750e17f7f77e8bbd9ce42c7d71d8ce9388 /lolcat.c | |
parent | 35dca3d0a381496d7195cd78f5b24aa7b62f2154 (diff) | |
download | lolcat-6e1caef075b973999cda4cac5b3fb40b6a4b5408.tar.gz lolcat-6e1caef075b973999cda4cac5b3fb40b6a4b5408.tar.bz2 lolcat-6e1caef075b973999cda4cac5b3fb40b6a4b5408.zip |
lolcat: Fix segfault on launch when LANG is undefined
Closes #27
Diffstat (limited to 'lolcat.c')
-rw-r--r-- | lolcat.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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, ""); |