### 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)
if (curve.is_null()) {
		return Ref<Texture2D>();
	}
	Size2 thumbnail_size = p_size * EDSCALE;
	Ref<Image> img_ref;
	img_ref.instantiate();
	Image &im = **img_ref;
	im.initialize_data(thumbnail_size.x, thumbnail_size.y, false, Image::FORMAT_RGBA8);
	Color bg_color(0.1, 0.1, 0.1, 1.0);
	Color line_color(0.8, 0.8, 0.8, 1.0);
	im.fill(bg_color);
	/
	float v = (curve->sample_baked(0) - curve->get_min_value()) / curve->get_range();
	int y = CLAMP(im.get_height() - v * im.get_height(), 0, im.get_height() - 1);
	im.set_pixel(0, y, line_color);
	/
	int prev_y = y;
	for (int x = 1; x < im.get_width(); ++x) {
		float t = static_cast<float>(x) / im.get_width();
		v = (curve->sample_baked(t) - curve->get_min_value()) / curve->get_range();
		y = CLAMP(im.get_height() - v * im.get_height(), 0, im.get_height() - 1);
		Vector<Point2i> points = Geometry2D::bresenham_line(Point2i(x - 1, prev_y), Point2i(x, y));
		for (Point2i point : points) {
			im.set_pixelv(point, line_color);
		}
		prev_y = y;
	}
	return ImageTexture::create_from_image(img_ref);
}