### 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
name_edit_popup->set_position(state_machine_draw->get_screen_position() + edit_rect.position);
					name_edit_popup->set_size(edit_rect.size);
					name_edit->set_text(node_rects[i].node_name);
					name_edit_popup->popup();
					name_edit->grab_focus();
					name_edit->select_all();
					prev_name = node_rects[i].node_name;
					return;
				}
			}
			if (node_rects[i].edit.has_point(mb->get_position())) { 
				call_deferred(SNAME("_open_editor"), node_rects[i].node_name);
				return;
			}
			if (node_rects[i].node.has_point(mb->get_position())) { 
				selected_node = node_rects[i].node_name;
				if (!selected_nodes.has(selected_node)) {
					selected_nodes.clear();
				}
				selected_nodes.insert(selected_node);
				Ref<AnimationNode> anode = state_machine->get_node(selected_node);
				EditorNode::get_singleton()->push_item(anode.ptr(), "", true);
				state_machine_draw->queue_redraw();
				dragging_selected_attempt = true;
				dragging_selected = false;
				drag_from = mb->get_position();
				snap_x = StringName();
				snap_y = StringName();
				_update_mode();
				return;