### 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
tl.hidden = true;
				transition_lines.write[j].disabled = transition_lines[j].disabled && tl.disabled;
				transition_lines.write[j].multi_transitions.push_back(tl);
			}
		}
		transition_lines.push_back(tl);
	}
	for (int i = 0; i < transition_lines.size(); i++) {
		TransitionLine tl = transition_lines[i];
		if (!tl.hidden) {
			_connection_draw(tl.from, tl.to, tl.mode, !tl.disabled, tl.selected, tl.travel, tl.fade_ratio, tl.auto_advance, !tl.multi_transitions.is_empty());
		}
	}
	
	for (int i = 0; i < node_rects.size(); i++) {
		String name = node_rects[i].node_name;
		Ref<AnimationNode> anode = state_machine->get_node(name);
		bool needs_editor = AnimationTreeEditor::get_singleton()->can_edit(anode);
		Ref<StyleBox> sb = selected_nodes.has(name) ? style_selected : style;
		int strsize = font->get_string_size(name, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).width;
		NodeRect &nr = node_rects.write[i];
		Vector2 offset = nr.node.position;
		int h = nr.node.size.height;
		
		
		state_machine_draw->draw_style_box(sb, nr.node);
		if (state_machine->start_node == name) {
			state_machine_draw->draw_style_box(sb == style_selected ? style_selected : start_overlay, nr.node);
		}
		if (state_machine->end_node == name) {