diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-08-12 11:35:13 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-08-12 11:35:13 +0300 |
commit | c6e1432cc0e98047c473f001a17142cbcd98d99e (patch) | |
tree | f5b2a03a540f83886ee28bf13b5463e8cb083b5a /scene/resources | |
parent | 67d40155206e7c15575ec9bd5b609075784ed746 (diff) |
[Font] Set TextServer font data pointer when it's null, to prevent TS from reading old, non-existing data.
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/font.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 619036d296..c4e1fc18fa 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -1817,11 +1817,9 @@ void FontFile::set_data_ptr(const uint8_t *p_data, size_t p_size) { data_ptr = p_data; data_size = p_size; - if (data_ptr != nullptr) { - for (int i = 0; i < cache.size(); i++) { - if (cache[i].is_valid()) { - TS->font_set_data_ptr(cache[i], data_ptr, data_size); - } + for (int i = 0; i < cache.size(); i++) { + if (cache[i].is_valid()) { + TS->font_set_data_ptr(cache[i], data_ptr, data_size); } } } @@ -1831,11 +1829,9 @@ void FontFile::set_data(const PackedByteArray &p_data) { data_ptr = data.ptr(); data_size = data.size(); - if (data_ptr != nullptr) { - for (int i = 0; i < cache.size(); i++) { - if (cache[i].is_valid()) { - TS->font_set_data_ptr(cache[i], data_ptr, data_size); - } + for (int i = 0; i < cache.size(); i++) { + if (cache[i].is_valid()) { + TS->font_set_data_ptr(cache[i], data_ptr, data_size); } } } |