Merge pull request #53286 from bruvzg/fix_font_data_save

This commit is contained in:
Rémi Verschelde 2021-10-01 09:42:48 +02:00 committed by GitHub
commit 8be97e3b51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}