From e53e1c566ac9e2e9b829f1cdbfd5d27537053cd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 28 Oct 2019 08:07:29 +0100 Subject: Fix some crashes and using null pointers --- core/translation.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core/translation.cpp') diff --git a/core/translation.cpp b/core/translation.cpp index a0902d71fc..4a1ac26433 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -986,6 +986,7 @@ Array TranslationServer::get_loaded_locales() const { for (const Set >::Element *E = translations.front(); E; E = E->next()) { const Ref &t = E->get(); + ERR_FAIL_COND_V(t.is_null(), Array()); String l = t->get_locale(); locales.push_back(l); @@ -1057,6 +1058,7 @@ StringName TranslationServer::translate(const StringName &p_message) const { for (const Set >::Element *E = translations.front(); E; E = E->next()) { const Ref &t = E->get(); + ERR_FAIL_COND_V(t.is_null(), StringName("")); String l = t->get_locale(); if (lptr[0] != l[0] || lptr[1] != l[1]) continue; // Language code does not match. @@ -1085,6 +1087,7 @@ StringName TranslationServer::translate(const StringName &p_message) const { for (const Set >::Element *E = translations.front(); E; E = E->next()) { const Ref &t = E->get(); + ERR_FAIL_COND_V(t.is_null(), StringName("")); String l = t->get_locale(); if (fptr[0] != l[0] || fptr[1] != l[1]) continue; // Language code does not match. -- cgit v1.2.3