### Godot version

41e5f5b0930343ef548a56d553ba20fafd672147

### System information

Windows 10, Vulkan, Intel® Core™ i7-8700K, Nvidia GTX 1080 (471.11)

### Issue description

The editor will crash if you select an AnimationTree node then select another node. This seems to be caused by the edit function assigning a null object via the edit interface, then calling another function which does not appear to be null.

### Steps to reproduce

Create an AnimationTree node then select another node.

### Minimal reproduction project

N/A
if (selected_nodes.size() == 1 && ansm.is_valid()) {
				tool_group->set_disabled(true);
				tool_group->set_visible(false);
				tool_ungroup->set_visible(true);
			} else {
				tool_group->set_disabled(false);
				tool_group->set_visible(true);
				tool_ungroup->set_visible(false);
			}
		}
	} else {
		selection_tools_hb->hide();
	}
	if (tool_connect->is_pressed()) {
		transition_tools_hb->show();
	} else {
		transition_tools_hb->hide();
	}
}
void AnimationNodeStateMachineEditor::_bind_methods() {
	ClassDB::bind_method("_update_graph", &AnimationNodeStateMachineEditor::_update_graph);
	ClassDB::bind_method("_open_editor", &AnimationNodeStateMachineEditor::_open_editor);
	ClassDB::bind_method("_connect_to", &AnimationNodeStateMachineEditor::_connect_to);
	ClassDB::bind_method("_stop_connecting", &AnimationNodeStateMachineEditor::_stop_connecting);
	ClassDB::bind_method("_delete_selected", &AnimationNodeStateMachineEditor::_delete_selected);
	ClassDB::bind_method("_delete_all", &AnimationNodeStateMachineEditor::_delete_all);
	ClassDB::bind_method("_delete_tree_draw", &AnimationNodeStateMachineEditor::_delete_tree_draw);
}
AnimationNodeStateMachineEditor *AnimationNodeStateMachineEditor::singleton = nullptr;
AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {