Browse Source

Merge pull request #48911 from timothyqiu/face-crash

[3.x] Fix crash when using get_available_chars with invalid DynamicFontData
Rémi Verschelde 4 years ago
parent
commit
c311b4c039
1 changed files with 4 additions and 0 deletions
  1. 4 0
      scene/resources/dynamic_font.cpp

+ 4 - 0
scene/resources/dynamic_font.cpp

@@ -256,6 +256,10 @@ Size2 DynamicFontAtSize::get_char_size(CharType p_char, CharType p_next, const V
 }
 }
 
 
 String DynamicFontAtSize::get_available_chars() const {
 String DynamicFontAtSize::get_available_chars() const {
+	if (!valid) {
+		return "";
+	}
+
 	String chars;
 	String chars;
 
 
 	FT_UInt gindex;
 	FT_UInt gindex;