Browse Source

Fix a segfault in ConnectDialog if the destination node does not exist

(cherry picked from commit ed108fc9939a1246a028679e764cacb6d5498306)
Sébastien Dunne Fulmer 1 year ago
parent
commit
34e97c2b65
1 changed files with 7 additions and 1 deletions
  1. 7 1
      editor/connections_dialog.cpp

+ 7 - 1
editor/connections_dialog.cpp

@@ -453,7 +453,13 @@ void ConnectDialog::_update_ok_enabled() {
 }
 
 void ConnectDialog::_update_warning_label() {
-	Ref<Script> scr = source->get_node(dst_path)->get_script();
+	Node *dst = source->get_node(dst_path);
+	if (dst == nullptr) {
+		warning_label->set_visible(false);
+		return;
+	}
+
+	Ref<Script> scr = dst->get_script();
 	if (scr.is_null()) {
 		warning_label->set_visible(false);
 		return;