### 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
end_overlay->set_border_width_all(1 * EDSCALE);
	end_overlay->set_border_color(Color::html("#f26661"));
	bool playing = false;
	StringName current;
	StringName blend_from;
	Vector<StringName> travel_path;
	if (playback.is_valid()) {
		playing = playback->is_playing();
		current = playback->get_current_node();
		blend_from = playback->get_fading_from_node();
		travel_path = playback->get_travel_path();
	}
	if (state_machine_draw->has_focus()) {
		state_machine_draw->draw_rect(Rect2(Point2(), state_machine_draw->get_size()), accent, false);
	}
	int sep = 3 * EDSCALE;
	List<StringName> nodes;
	state_machine->get_node_list(&nodes);
	node_rects.clear();
	Rect2 scroll_range;
	
	if (dragging_selected) {
		Vector2 from = (state_machine->get_node_position(selected_node) * EDSCALE) + drag_ofs - state_machine->get_graph_offset() * EDSCALE;
		if (snap_x != StringName()) {
			Vector2 to = (state_machine->get_node_position(snap_x) * EDSCALE) - state_machine->get_graph_offset() * EDSCALE;
			state_machine_draw->draw_line(from, to, linecolor, 2);
		}
		if (snap_y != StringName()) {
			Vector2 to = (state_machine->get_node_position(snap_y) * EDSCALE) - state_machine->get_graph_offset() * EDSCALE;
			state_machine_draw->draw_line(from, to, linecolor, 2);