1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

Language: Check if lang exists in fallback hash before adding it [#330]

This commit is contained in:
gnosygnu
2019-02-17 19:22:26 -05:00
parent e744c5123a
commit c383f2a231
3 changed files with 43 additions and 9 deletions

View File

@@ -263,13 +263,7 @@ public class Scrib_lib_language implements Scrib_lib {
}
private Xol_lang_itm lang_(Scrib_proc_args args) {
byte[] lang_code = args.Cast_bry_or_null(0);
Xol_lang_itm lang = null;
try {
lang = lang_code == null ? null : core.App().Lang_mgr().Get_by_or_load(lang_code);
}
catch (Exception exc) {
throw Err_.new_wo_type("mw.lang: Unable to get lang", "page", core.Page().Url_bry_safe(), "lang", lang_code, "err", Err_.Message_gplx_log(exc));
}
Xol_lang_itm lang = lang_code == null ? null : core.App().Lang_mgr().Get_by_or_load(lang_code);
if (lang == null) throw Err_.new_wo_type("lang_code is not valid", "lang_code", String_.new_u8(lang_code));
return lang;
}