### Godot version

4.1.beta1

### System information

macOS 13.3.1 mobile renderer

### Issue description

Trying to open and edit one of my visual shaders now consistently crashes Godot 4.1beta1. 

The shader was made and edited fine in earlier versions of Godot 4 and I'm not certain what is special with this shader (attached below for investigation). Opening and editing other visual shaders works fine for me. The only thing I can think of that this shader uses that other do not is the gradient node, though as I can't open it I'm not sure what else might be going on in it.

### Steps to reproduce

Open the attached visual shader (in any project)

### Minimal reproduction project

[ConnectBlendShader.tres.zip](https://www.lostminds.com/godot/ConnectBlendShader.tres.zip)
ERR_FAIL_COND(curve.is_null());
	ERR_FAIL_INDEX_MSG(p_index, curve->get_point_count(), "Curve point is out of bounds.");
	if (p_tangent == TANGENT_NONE) {
		return;
	}
	EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
	undo_redo->create_action(TTR("Toggle Linear Curve Point's Tangent"));
	Curve::TangentMode prev_mode = (p_tangent == TANGENT_LEFT) ? curve->get_point_left_mode(p_index) : curve->get_point_right_mode(p_index);
	Curve::TangentMode mode = (prev_mode == Curve::TANGENT_LINEAR) ? Curve::TANGENT_FREE : Curve::TANGENT_LINEAR;
	float prev_angle = (p_tangent == TANGENT_LEFT) ? curve->get_point_left_tangent(p_index) : curve->get_point_right_tangent(p_index);
	
	if (p_tangent == TANGENT_LEFT) {
		undo_redo->add_do_method(*curve, "set_point_left_mode", p_index, mode);
		undo_redo->add_undo_method(*curve, "set_point_left_mode", p_index, prev_mode);
		undo_redo->add_undo_method(*curve, "set_point_left_tangent", p_index, prev_angle);
	} else {
		undo_redo->add_do_method(*curve, "set_point_right_mode", p_index, mode);
		undo_redo->add_undo_method(*curve, "set_point_right_mode", p_index, prev_mode);
		undo_redo->add_undo_method(*curve, "set_point_right_tangent", p_index, prev_angle);
	}
	undo_redo->commit_action();
}
void CurveEdit::set_selected_index(int p_index) {