summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-10-01 09:42:48 +0200
committerGitHub <noreply@github.com>2021-10-01 09:42:48 +0200
commit8be97e3b51f5adbee0f9f5d3193da53680a44695 (patch)
tree0416008c7bd739545e4eaa7aab32a76261c64aec
parentdf57aa670af563afafd7e38505bb0a939b2042af (diff)
parent2e035272a8e9abdb5c2265877b24e51a0b0e834a (diff)
Merge pull request #53286 from bruvzg/fix_font_data_save
-rw-r--r--scene/resources/font.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index 9b403a18f0..de561bb852 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -502,6 +502,11 @@ void FontData::set_data(const PackedByteArray &p_data) {
}
PackedByteArray FontData::get_data() const {
+ if (unlikely((size_t)data.size() != data_size)) {
+ PackedByteArray *data_w = const_cast<PackedByteArray *>(&data);
+ data_w->resize(data_size);
+ memcpy(data_w->ptrw(), data_ptr, data_size);
+ }
return data;
}