### Godot version

v4.1.beta.custom_build [01453ab7f]

### System information

macOS 13.3.0 - Vulkan (Forward+) - integrated Apple M1 Pro - Apple M1 Pro (8 Threads)

### Issue description

When Batch renaming multiple nodes to empty nodes, this will error out instead of using the class name. Moreover item name will be set to empty instead of reverting them back. 

https://github.com/godotengine/godot/assets/66184050/ca8dcd75-a306-428e-87ff-7c39c231d101



### Steps to reproduce

1. create a scene with one root and multiple child nodes
2. batch rename them by replacing N by P
3. batch rename them using regular expression to set them all to empty string (using regular expression `.*`)
4. see errors and bugged out items
5. unselect nodes their name will reappear you can see nothing has been set

### Minimal reproduction project

with MRP you can start at step 3
[Test.zip](https://github.com/godotengine/godot/files/11763532/Test.zip)

if (!can_rename) {
		return Variant(); //not editable tree
	}
	if (tree->get_button_id_at_position(p_point) != -1) {
		return Variant(); //dragging from button
	}
	Vector<Node *> selected_nodes;
	Vector<Ref<Texture2D>> icons;
	TreeItem *next = tree->get_next_selected(nullptr);
	while (next) {
		NodePath np = next->get_metadata(0);
		Node *n = get_node(np);
		if (n) {
			// O
			if (!n->get_owner() || n->get_owner() == get_scene_node() || n->get_owner()->get_scene_file_path().is_empty()) {
				selected_nodes.push_back(n);
				icons.push_back(next->get_icon(0));
			}
		}
		next = tree->get_next_selected(next);
	}
	if (selected_nodes.is_empty()) {
		return Variant();
	}
	VBoxContainer *vb = memnew(VBoxContainer);
	Array objs;
	int list_max = 10;