### Godot version

v4.1.rc2.official [46424488e]

### System information

Godot v4.1.rc2 - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 (NVIDIA; 31.0.15.3623) - AMD Ryzen 7 5700G with Radeon Graphics (16 Threads)

### Issue description

When setting the AnimationTree to active, Godot crashes.

### Steps to reproduce

https://github.com/godotengine/godot/assets/46705245/dbe5eb81-1357-43e8-ac80-a4eb97eea9fc

### Minimal reproduction project

[Crash.zip](https://github.com/godotengine/godot/files/11945826/Crash.zip)

for (int i = 0; i < transitions.size(); i++) {
		if (transitions[i].transition == p_transition) {
			remove_transition_by_index(i);
			return;
		}
	}
}
void AnimationNodeStateMachine::set_graph_offset(const Vector2 &p_offset) {
	graph_offset = p_offset;
}
Vector2 AnimationNodeStateMachine::get_graph_offset() const {
	return graph_offset;
}
double AnimationNodeStateMachine::_process(double p_time, bool p_seek, bool p_is_external_seeking, bool p_test_only) {
	Ref<AnimationNodeStateMachinePlayback> playback_new = get_parameter(playback);
	ERR_FAIL_COND_V(playback_new.is_null(), 0.0);
	playback_new->_set_grouped(state_machine_type == STATE_MACHINE_TYPE_GROUPED);
	if (p_test_only) {
		playback_new = playback_new->duplicate(); 
	}
	return playback_new->process(base_path, this, p_time, p_seek, p_is_external_seeking, p_test_only);
}
String AnimationNodeStateMachine::get_caption() const {
	return "StateMachine";
}
Ref<AnimationNode> AnimationNodeStateMachine::get_child_by_name(const StringName &p_name) const {
	return get_node(p_name);
}
bool AnimationNodeStateMachine::_set(const StringName &p_name, const Variant &p_value) {