### Godot version

4.2.dev.custom_build. 6588a4a29

### System information

Ubuntu 22.04 CI

### Issue description

When executing
```
extends Node
func _process(delta):

	var temp_variable5727 = TileMap.new()
	add_child(temp_variable5727)
	temp_variable5727.set_collision_animatable(true)
	temp_variable5727.get_layer_navigation_map(71)
	temp_variable5727.clear()
	temp_variable5727.set_cell(-1, Vector2i(47, 89), 92, Vector2i(3, -31), 66)
	temp_variable5727.fix_invalid_tiles()
```
Godot crashes:
```
  ERROR: Index p_layer = 71 is out of bounds ((int)layers.size() = 1).
   at: get_layer_navigation_map (scene/2d/tile_map.cpp:3116)
scene/resources/tile_set.cpp:549:2: runtime error: member access within null pointer of type 'const struct TileSet'
scene/resources/tile_set.cpp:549:2: runtime error: member access within null pointer of type 'const struct TileSet'

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.2.dev.custom_build (6588a4a29af1621086feac0117d5d4d37af957fd)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] ./godot.linuxbsd.editor.dev.x86_64.san(+0x2dc3c49c) [0x56135538b49c] (/home/runner/work/Qarminer/Qarminer/godot/platform/linuxbsd/crash_handler_linuxbsd.cpp:57)
[2] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7fbf6cffd520] (??:0)
[3] HashMap<int, Ref<TileSetSource>, HashMapHasherDefault, HashMapComparatorDefault<int>, DefaultTypedAllocator<HashMapElement<int, Ref<TileSetSource> > > >::_lookup_pos(int const&, unsigned int&) const (/home/runner/work/Qarminer/Qarminer/godot/./core/templates/hash_map.h:100)
[4] HashMap<int, Ref<TileSetSource>, HashMapHasherDefault, HashMapComparatorDefault<int>, DefaultTypedAllocator<HashMapElement<int, Ref<TileSetSource> > > >::has(int const&) const (/home/runner/work/Qarminer/Qarminer/godot/./core/templates/hash_map.h:310)
[5] TileSet::get_source(int) const (/home/runner/work/Qarminer/Qarminer/godot/scene/resources/tile_set.cpp:549)
[6] TileMapLayer::fix_invalid_tiles() (/home/runner/work/Qarminer/Qarminer/godot/scene/2d/tile_map.cpp:2276 (discriminator 3))
[7] TileMap::fix_invalid_tiles() (/home/runner/work/Qarminer/Qarminer/godot/scene/2d/tile_map.cpp:3296 (discriminator 3))
[8] void call_with_variant_args_helper<__UnexistingClass>(__UnexistingClass*, void (__UnexistingClass::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (/home/runner/work/Qarminer/Qarminer/godot/./core/variant/binder_common.h:308 (discriminator 4))
[9] void call_with_variant_args_dv<__UnexistingClass>(__UnexistingClass*, void (__UnexistingClass::*)(), Variant const**, int, Callable::CallError&, Vector<Variant> const&) (/home/runner/work/Qarminer/Qarminer/godot/./core/variant/binder_common.h:421)
[10] MethodBindT<>::call(Object*, Variant const**, int, Callable::CallError&) const (/home/runner/work/Qarminer/Qarminer/godot/./core/object/method_bind.h:331)
[11] Object::callp(StringName const&, Variant const**, int, Callable::CallError&) (/home/runner/work/Qarminer/Qarminer/godot/core/object/object.cpp:739 (discriminator 1))
[12] Variant::callp(StringName const&, Variant const**, int, Variant&, Callable::CallError&) (/home/runner/work/Qarminer/Qarminer/godot/core/variant/variant_call.cpp:1174)
[13] GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Callable::CallError&, GDScriptFunction::CallState*) (/home/runner/work/Qarminer/Qarminer/godot/modules/gdscript/gdscript_vm.cpp:1690)
[14] GDScriptInstance::callp(StringName const&, Variant const**, int, Callable::CallError&) (/home/runner/work/Qarminer/Qarminer/godot/modules/gdscript/gdscript.cpp:1892)
[15] bool Node::_gdvirtual__process_call<false>(double) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/node.h:318 (discriminator 5))
[16] Node::_notification(int) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/node.cpp:57)
[17] Node::_notificationv(int, bool) (/home/runner/work/Qarminer/Qarminer/godot/./scene/main/node.h:49 (discriminator 14))
[18] Object::notification(int, bool) (/home/runner/work/Qarminer/Qarminer/godot/core/object/object.cpp:798)
[19] SceneTree::_process_group(SceneTree::ProcessGroup*, bool) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/scene_tree.cpp:944)
[20] SceneTree::_process(bool) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/scene_tree.cpp:1016 (discriminator 2))
[21] SceneTree::process(double) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/scene_tree.cpp:510 (discriminator 4))
[22] Main::iteration() (/home/runner/work/Qarminer/Qarminer/godot/main/main.cpp:3434)
[23] OS_LinuxBSD::run() (/home/runner/work/Qarminer/Qarminer/godot/platform/linuxbsd/os_linuxbsd.cpp:912)
[24] ./godot.linuxbsd.editor.dev.x86_64.san(main+0x58f) [0x56135538ae48] (/home/runner/work/Qarminer/Qarminer/godot/platform/linuxbsd/godot_linuxbsd.cpp:76)
[25] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7fbf6cfe4d90] (??:0)
[26] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7fbf6cfe4e40] (??:0)
[27] ./godot.linuxbsd.editor.dev.x86_64.san(_start+0x25) [0x56135538a7f5] (??:?)
```


This example was found by Godot fuzzer - [Qarminer](https://github.com/qarmin/Qarminer), so it is quite unlikelly that this code could be used in real project, but still this should be handled gracefully.

Memory leaks or asan backtraces are visibe when using Godot build with sanitizers support - https://github.com/qarmin/GodotBuilds/actions (linux -> linux-editor-sanitizers)


### Steps to reproduce

Above

### Minimal reproduction project

Above
RenderingServer *rs = RenderingServer::get_singleton();
	if (!canvas_item.is_valid()) {
		RID ci = rs->canvas_item_create();
		rs->canvas_item_set_parent(ci, tile_map_node->get_canvas_item());
		rs->canvas_item_set_draw_index(ci, layer_index_in_tile_map_node - (int64_t)0x80000000);
		canvas_item = ci;
	}
	RID &ci = canvas_item;
	rs->canvas_item_set_sort_children_by_y(ci, y_sort_enabled);
	rs->canvas_item_set_use_parent_material(ci, tile_map_node->get_use_parent_material() || tile_map_node->get_material().is_valid());
	rs->canvas_item_set_z_index(ci, z_index);
	rs->canvas_item_set_default_texture_filter(ci, RS::CanvasItemTextureFilter(tile_map_node->get_texture_filter_in_tree()));
	rs->canvas_item_set_default_texture_repeat(ci, RS::CanvasItemTextureRepeat(tile_map_node->get_texture_repeat_in_tree()));
	rs->canvas_item_set_light_mask(ci, tile_map_node->get_light_mask());
	Color layer_modulate = modulate;
	int selected_layer = tile_map_node->get_selected_layer();
	if (selected_layer >= 0 && layer_index_in_tile_map_node != selected_layer) {
		int z_selected = tile_map_node->get_layer_z_index(selected_layer);
		if (z_index < z_selected || (z_index == z_selected && layer_index_in_tile_map_node < selected_layer)) {
			layer_modulate = layer_modulate.darkened(0.5);
		} else if (z_index > z_selected || (z_index == z_selected && layer_index_in_tile_map_node > selected_layer)) {
			layer_modulate = layer_modulate.darkened(0.5);
			layer_modulate.a *= 0.3;
		}
	}
	rs->canvas_item_set_modulate(ci, layer_modulate);
}
void TileMapLayer::_rendering_cleanup() {