summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Manuel <johan.manuel@live.fr>2016-07-23 23:59:24 +0200
committerJohan Manuel <johan.manuel@live.fr>2016-07-24 00:25:32 +0200
commit580b4465c6aa98063ceb34288f2f37e83df4baaf (patch)
tree4ab2f5c89b234b44209bc1a8dc4dccc373c38df8
parent221cb58382ae34d4f91d9923fd979a328feabace (diff)
Fix crash when GraphNode wasn't a child of a Control
-rw-r--r--scene/gui/graph_node.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index 94001b2ac1..3705541865 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -559,7 +559,12 @@ Color GraphNode::get_connection_output_color(int p_idx) {
void GraphNode::_input_event(const InputEvent& p_ev) {
if (p_ev.type==InputEvent::MOUSE_BUTTON) {
+
+ ERR_EXPLAIN("GraphNode must be the child of a GraphEdit node.");
+ ERR_FAIL_COND(get_parent_control() == NULL);
+
get_parent_control()->grab_focus();
+
if(p_ev.mouse_button.pressed && p_ev.mouse_button.button_index==BUTTON_LEFT) {
Vector2 mpos = Vector2(p_ev.mouse_button.x,p_ev.mouse_button.y);