X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=ui%2Fncurses%2Fnc-lang.c;h=a7c9ccc53bb53f24b755a2d2c3109752dc4da05e;hp=7879c457cfe9eb8daa877f56cbd51f8e87df63d0;hb=27863350496534c1bdd6a2d48661f8973aed0945;hpb=23f5f7e3efac36e5bee73e4028e18bcf9cfdc562 diff --git a/ui/ncurses/nc-lang.c b/ui/ncurses/nc-lang.c index 7879c45..a7c9ccc 100644 --- a/ui/ncurses/nc-lang.c +++ b/ui/ncurses/nc-lang.c @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -265,8 +266,14 @@ static void lang_screen_setup_widgets(struct lang_screen *screen, len = wcstombs(NULL, lang->label, 0); assert(len >= 0); - label = talloc_array(screen, char, len + 1); - wcstombs(label, lang->label, len + 1); + if (len < 0) { + label = talloc_asprintf(screen, + "Unable to display text in this locale (%s)\n", + setlocale(LC_ALL, NULL)); + } else { + label = talloc_array(screen, char, len + 1); + wcstombs(label, lang->label, len + 1); + } selected = config->lang && !strcmp(lang->name, config->lang); found |= selected;