From f07a377624062caff6290898eff663cb479d277e Mon Sep 17 00:00:00 2001 From: marynate Date: Thu, 3 Apr 2014 01:28:16 +0800 Subject: Fixed delete path2d node will crash editor --- tools/editor/plugins/path_2d_editor_plugin.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/plugins/path_2d_editor_plugin.cpp b/tools/editor/plugins/path_2d_editor_plugin.cpp index cb15157aa8..341a17ab25 100644 --- a/tools/editor/plugins/path_2d_editor_plugin.cpp +++ b/tools/editor/plugins/path_2d_editor_plugin.cpp @@ -516,7 +516,6 @@ void Path2DEditor::_node_visibility_changed() { return; canvas_item_editor->get_viewport_control()->update(); - } void Path2DEditor::edit(Node *p_path2d) { @@ -533,15 +532,15 @@ void Path2DEditor::edit(Node *p_path2d) { if (!node->is_connected("visibility_changed", this, "_node_visibility_changed")) node->connect("visibility_changed", this, "_node_visibility_changed"); - } else { if (canvas_item_editor->get_viewport_control()->is_connected("draw",this,"_canvas_draw")) canvas_item_editor->get_viewport_control()->disconnect("draw",this,"_canvas_draw"); - if (node->is_connected("visibility_changed", this, "_node_visibility_changed")) + + // node may have been deleted at this point + if (node && node->is_connected("visibility_changed", this, "_node_visibility_changed")) node->disconnect("visibility_changed", this, "_node_visibility_changed"); node=NULL; - } } -- cgit v1.2.3