瀏覽代碼

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

Sébastien Dunne Fulmer 1 年之前
父節點
當前提交
ed108fc993
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      editor/connections_dialog.cpp

+ 7 - 1
editor/connections_dialog.cpp

@@ -452,7 +452,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;