diff options
-rw-r--r-- | src/gui/MachinaCanvas.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp index 6de0217..243930f 100644 --- a/src/gui/MachinaCanvas.cpp +++ b/src/gui/MachinaCanvas.cpp @@ -49,12 +49,11 @@ MachinaCanvas::MachinaCanvas(MachinaGUI* app, int width, int height) void MachinaCanvas::connect_nodes(GanvNode* node, void* data) { - NodeView* view = dynamic_cast<NodeView*>(Glib::wrap(node)); - if (!view) { - std::cerr << "error: Connect of node with no view" << std::endl; + MachinaCanvas* canvas = (MachinaCanvas*)data; + NodeView* view = dynamic_cast<NodeView*>(Glib::wrap(node)); + if (!view || view == canvas->_connect_node) { return; } - MachinaCanvas* canvas = (MachinaCanvas*)data; if (canvas->get_edge(view, canvas->_connect_node)) { canvas->action_disconnect(view, canvas->_connect_node); canvas->_did_connect = true; |