From 12af26b6668ff6b4a7c3c34c610bd57b0e17cf53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Arg=C3=BCelles?= Date: Sat, 24 Aug 2013 18:59:57 -0400 Subject: [PATCH] Add check for setlocale() In wide char mode it is important to be sure that setlocale() function succeed. --- src/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 91e8963..dc52753 100644 --- a/src/main.c +++ b/src/main.c @@ -50,7 +50,13 @@ static void init_term() { /* Setup terminal */ signal(SIGWINCH, on_window_resize); - setlocale(LC_ALL, ""); +#if HAVE_WIDECHAR + if (setlocale(LC_ALL, "") == NULL) { + printf("Could not set your locale, plese check your locale settings or" + "disable wide char support\n"); + exit(1); + } +#endif initscr(); cbreak(); keypad(stdscr, 1);