Browse Source

Fix crash when using get_available_chars with invalid DynamicFontData

(cherry picked from commit bec1dcb6f670e163196fded19964b7a6d0dc1570)
Haoyu Qiu 4 years ago
parent
commit
e14d5062f7
1 changed files with 4 additions and 0 deletions
  1. 4 0
      scene/resources/dynamic_font.cpp

+ 4 - 0
scene/resources/dynamic_font.cpp

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