Prevent the main locale from being set to an empty string

This commit is contained in:
Haoyu Qiu
2025-11-18 10:07:35 +08:00
parent 3f5b871666
commit 04ac5cbb89

View File

@ -464,6 +464,8 @@ String TranslationServer::get_country_name(const String &p_country) const {
} }
void TranslationServer::set_locale(const String &p_locale) { void TranslationServer::set_locale(const String &p_locale) {
ERR_FAIL_COND_MSG(p_locale.is_empty(), "Locale cannot be an empty string.");
String new_locale = standardize_locale(p_locale); String new_locale = standardize_locale(p_locale);
if (locale == new_locale) { if (locale == new_locale) {
return; return;