From 026617b5fbc57e2494cb6f586917856e1cbf99c8 Mon Sep 17 00:00:00 2001 From: Chaosus Date: Fri, 13 Apr 2018 12:07:47 +0300 Subject: [PATCH] Fix possible crash when clicking on Skeleton2D or Sprite editor options --- editor/plugins/skeleton_2d_editor_plugin.cpp | 5 +++++ editor/plugins/sprite_editor_plugin.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/editor/plugins/skeleton_2d_editor_plugin.cpp b/editor/plugins/skeleton_2d_editor_plugin.cpp index 6bf94b95ebe..e372f792d6c 100644 --- a/editor/plugins/skeleton_2d_editor_plugin.cpp +++ b/editor/plugins/skeleton_2d_editor_plugin.cpp @@ -20,6 +20,10 @@ void Skeleton2DEditor::edit(Skeleton2D *p_sprite) { void Skeleton2DEditor::_menu_option(int p_option) { + if (!node) { + return; + } + switch (p_option) { case MENU_OPTION_MAKE_REST: { @@ -107,6 +111,7 @@ Skeleton2DEditorPlugin::Skeleton2DEditorPlugin(EditorNode *p_node) { editor = p_node; sprite_editor = memnew(Skeleton2DEditor); editor->get_viewport()->add_child(sprite_editor); + make_visible(false); //sprite_editor->options->hide(); } diff --git a/editor/plugins/sprite_editor_plugin.cpp b/editor/plugins/sprite_editor_plugin.cpp index 99aabcb3ebf..49816fe2aee 100644 --- a/editor/plugins/sprite_editor_plugin.cpp +++ b/editor/plugins/sprite_editor_plugin.cpp @@ -80,6 +80,10 @@ Vector expand(const Vector &points, const Rect2i &rect, float void SpriteEditor::_menu_option(int p_option) { + if (!node) { + return; + } + switch (p_option) { case MENU_OPTION_CREATE_MESH_2D: { @@ -389,6 +393,7 @@ SpriteEditorPlugin::SpriteEditorPlugin(EditorNode *p_node) { editor = p_node; sprite_editor = memnew(SpriteEditor); editor->get_viewport()->add_child(sprite_editor); + make_visible(false); //sprite_editor->options->hide(); }