### 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
EditorNode::get_singleton()->push_item(tr.ptr(), "", true);
		_update_mode();
	}
	connecting = false;
}
void AnimationNodeStateMachineEditor::_connection_draw(const Vector2 &p_from, const Vector2 &p_to, AnimationNodeStateMachineTransition::SwitchMode p_mode, bool p_enabled, bool p_selected, bool p_travel, float p_fade_ratio, bool p_auto_advance, bool p_multi_transitions) {
	Color linecolor = get_theme_color(SNAME("font_color"), SNAME("Label"));
	Color icon_color(1, 1, 1);
	Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
	if (!p_enabled) {
		linecolor.a *= 0.2;
		icon_color.a *= 0.2;
		accent.a *= 0.6;
	}
	const Ref<Texture2D> icons[6] = {
		get_theme_icon(SNAME("TransitionImmediateBig"), SNAME("EditorIcons")),
		get_theme_icon(SNAME("TransitionSyncBig"), SNAME("EditorIcons")),
		get_theme_icon(SNAME("TransitionEndBig"), SNAME("EditorIcons")),
		get_theme_icon(SNAME("TransitionImmediateAutoBig"), SNAME("EditorIcons")),
		get_theme_icon(SNAME("TransitionSyncAutoBig"), SNAME("EditorIcons")),
		get_theme_icon(SNAME("TransitionEndAutoBig"), SNAME("EditorIcons"))
	};
	if (p_selected) {
		state_machine_draw->draw_line(p_from, p_to, accent, 6);
	}
	if (p_travel) {
		linecolor = accent;
	}
	state_machine_draw->draw_line(p_from, p_to, linecolor, 2);
	if (p_fade_ratio > 0.0) {