summaryrefslogtreecommitdiff
path: root/modules/text_server_adv
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2022-09-18 14:33:28 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2022-09-18 14:38:57 +0800
commit2d0d6e4f6396ff1f0f5d1e88167cf81d8242876a (patch)
tree48dd2cdd6562163eee18dfb33db3720cfda4ba25 /modules/text_server_adv
parent24115beb3c69e648b1d48f969785b9b0729e1be8 (diff)
Fix crash when executing `FontFile.get_face_count`
Diffstat (limited to 'modules/text_server_adv')
-rw-r--r--modules/text_server_adv/text_server_adv.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp
index 7aebeafe70..d90870107b 100644
--- a/modules/text_server_adv/text_server_adv.cpp
+++ b/modules/text_server_adv/text_server_adv.cpp
@@ -1940,12 +1940,12 @@ int64_t TextServerAdvanced::font_get_face_count(const RID &p_font_rid) const {
fargs.flags = FT_OPEN_MEMORY;
fargs.stream = &stream;
- FT_Face tmp_face;
+ FT_Face tmp_face = nullptr;
error = FT_Open_Face(ft_library, &fargs, -1, &tmp_face);
if (error == 0) {
face_count = tmp_face->num_faces;
+ FT_Done_Face(tmp_face);
}
- FT_Done_Face(tmp_face);
#endif
}