fix: Unrecognized language causes errors

This commit is contained in:
Lhcfl 2024-04-26 10:34:12 +08:00
parent 99f30ba01a
commit 41f9a0bda9

View file

@ -801,13 +801,17 @@ function setLanguage() {
actions.push(null); actions.push(null);
} }
if (language.value != null) if (language.value != null && langmap[language.value] != null) {
actions.push({ actions.push({
text: langmap[language.value].nativeName, text: langmap[language.value].nativeName,
danger: false, danger: false,
active: true, active: true,
action: () => {}, action: () => {},
}); });
} else {
// Unrecognized language, set to null
language.value = null;
}
const langs = Object.keys(langmap); const langs = Object.keys(langmap);