Unverified Commit 5e13c343 by Rémi Verschelde Committed by GitHub

Merge pull request #39663 from dreamsComeTrue/connect-dialog-method-name

Prevent having spaces in signal's method in Connect Dialog
parents 6d8c14f8 79f46da1
...@@ -108,17 +108,26 @@ public: ...@@ -108,17 +108,26 @@ public:
* Signal automatically called by parent dialog. * Signal automatically called by parent dialog.
*/ */
void ConnectDialog::ok_pressed() { void ConnectDialog::ok_pressed() {
if (dst_method->get_text() == "") { String method_name = dst_method->get_text();
if (method_name == "") {
error->set_text(TTR("Method in target node must be specified.")); error->set_text(TTR("Method in target node must be specified."));
error->popup_centered(); error->popup_centered();
return; return;
} }
if (!method_name.strip_edges().is_valid_identifier()) {
error->set_text(TTR("Method name must be a valid identifier."));
error->popup_centered();
return;
}
Node *target = tree->get_selected(); Node *target = tree->get_selected();
if (!target) { if (!target) {
return; // Nothing selected in the tree, not an error. return; // Nothing selected in the tree, not an error.
} }
if (target->get_script().is_null()) { if (target->get_script().is_null()) {
if (!target->has_method(dst_method->get_text())) { if (!target->has_method(method_name)) {
error->set_text(TTR("Target method not found. Specify a valid method or attach a script to the target node.")); error->set_text(TTR("Target method not found. Specify a valid method or attach a script to the target node."));
error->popup_centered(); error->popup_centered();
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment