summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-06-13 22:24:11 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-06-13 22:24:11 -0300
commit944c7e26038ff82c4666fa2c3814c612ef576761 (patch)
treec0194e0dd355b1e8e7993ed5116115ec42e46f5b /scene/resources
parent64b4253dbfe3fdfc4efa405086d23765a9774d91 (diff)
fix crash when clearing dynamicfontdata, closes #4877
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/dynamic_font.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index 78a5571bf0..1edae01754 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -573,7 +573,11 @@ DynamicFontAtSize::~DynamicFontAtSize(){
void DynamicFont::set_font_data(const Ref<DynamicFontData>& p_data) {
data=p_data;
- data_at_size=data->_get_dynamic_font_at_size(size);
+ if (data.is_valid())
+ data_at_size=data->_get_dynamic_font_at_size(size);
+ else
+ data_at_size=Ref<DynamicFontAtSize>();
+
emit_changed();
}