diff options
author | Hein-Pieter van Braam <hp@tmm.cx> | 2019-02-27 00:44:09 +0000 |
---|---|---|
committer | Hein-Pieter van Braam <hp@tmm.cx> | 2019-02-27 00:44:09 +0000 |
commit | 464e1142c48da5d24fb9d2462b707b695f9b5adc (patch) | |
tree | afcea9919530d7414f876734d1c33c29f24bf78f /editor/plugins/editor_preview_plugins.cpp | |
parent | 270bbee018ff42f3e9fa400d960a6c63a4918f3a (diff) | |
download | redot-engine-464e1142c48da5d24fb9d2462b707b695f9b5adc.tar.gz |
Don't crash on previewing an AtlasTexture without a region
Diffstat (limited to 'editor/plugins/editor_preview_plugins.cpp')
-rw-r--r-- | editor/plugins/editor_preview_plugins.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 3cf46e5b91..58d7968723 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -92,7 +92,12 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES &p_from, const Size2 if (!tex.is_valid()) { return Ref<Texture>(); } + Ref<Image> atlas = tex->get_data(); + if (!atlas.is_valid()) { + return Ref<Texture>(); + } + img = atlas->get_rect(atex->get_region()); } else if (ltex.is_valid()) { img = ltex->to_image(); |