### 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
connecting = false;
	state_machine_draw->queue_redraw();
}
void AnimationNodeStateMachineEditor::_delete_selected() {
	TreeItem *item = delete_tree->get_next_selected(nullptr);
	EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
	while (item) {
		if (!updating) {
			updating = true;
			selected_multi_transition = TransitionLine();
			undo_redo->create_action("Transition(s) Removed");
		}
		Vector<String> path = item->get_text(0).split(" -> ");
		selected_transition_from = path[0];
		selected_transition_to = path[1];
		_erase_selected(true);
		item = delete_tree->get_next_selected(item);
	}
	if (updating) {
		undo_redo->commit_action();
		updating = false;
	}
}
void AnimationNodeStateMachineEditor::_delete_all() {