### Godot version

 v4.0.beta11.official.91713ced8

### System information

macOS 12.6.1 Monterey, Apple M1 Pro

### Issue description

After reopening scenes with Sprite2D and trying to edit the region of the sprite again the Godot app crashed.

### Steps to reproduce

1. Open scene node_2d in the project files
2. Go to Sprite2D and click on edit region, pop up should show
3. Close the popup and close the scene with X on the tab
4. Reopen the scene, go to Sprite2D and click on Edit region
5. Godot should crash

### Minimal reproduction project

[region_crash.zip](https://github.com/godotengine/godot/files/10400566/region_crash.zip)

if (atlas_tex.is_valid()) {
		rect = atlas_tex->get_region();
	} else if (node_sprite_2d) {
		rect = node_sprite_2d->get_region_rect();
	} else if (node_sprite_3d) {
		rect = node_sprite_3d->get_region_rect();
	} else if (node_ninepatch) {
		rect = node_ninepatch->get_region_rect();
		if (rect == Rect2()) {
			rect = Rect2(Vector2(), node_ninepatch->get_texture()->get_size());
		}
	} else if (obj_styleBox.is_valid()) {
		rect = obj_styleBox->get_region_rect();
	}
}
void TextureRegionEditor::_update_autoslice() {
	autoslice_is_dirty = false;
	autoslice_cache.clear();
	Ref<Texture2D> texture = nullptr;
	if (atlas_tex.is_valid()) {
		texture = atlas_tex->get_atlas();
	} else if (node_sprite_2d) {
		texture = node_sprite_2d->get_texture();