diff options
-rw-r--r-- | src/lib/ux_locales.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/lib/ux_locales.c b/src/lib/ux_locales.c index a2e38fc1dc..0a285d9b67 100644 --- a/src/lib/ux_locales.c +++ b/src/lib/ux_locales.c @@ -116,7 +116,7 @@ const char *ux_locales_get_text(const char *name) { const char *data; size_t size, offset, name_offset, next_name_offset, next; - uint32_t lang_id; + uint32_t lang_id = 0; /* default language English (0) */ unsigned char version; data = locales_get_map(&size, false); @@ -126,13 +126,15 @@ const char *ux_locales_get_text(const char *name) return NULL; } - /* Get the language ID from vboot API. */ - lang_id = vb2api_get_locale_id(vboot_get_context()); - /* Validity check: Language ID should smaller than LANG_ID_MAX. */ - if (lang_id >= LANG_ID_MAX) { - printk(BIOS_WARNING, "%s: ID %d too big; fallback to 0.\n", - __func__, lang_id); - lang_id = 0; + if (CONFIG(VBOOT)) { + /* Get the language ID from vboot API. */ + lang_id = vb2api_get_locale_id(vboot_get_context()); + /* Validity check: Language ID should smaller than LANG_ID_MAX. */ + if (lang_id >= LANG_ID_MAX) { + printk(BIOS_WARNING, "%s: ID %d too big; fallback to 0.\n", + __func__, lang_id); + lang_id = 0; + } } printk(BIOS_INFO, "%s: Search for %s with language ID: %u\n", |