Parcourir la source

Merge pull request #83937 from Jordyfel/potential-crash-on-move

Fix potential crash on failed move
Rémi Verschelde il y a 1 an
Parent
commit
27679dbfa4
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 3 1
      editor/filesystem_dock.cpp

+ 3 - 1
editor/filesystem_dock.cpp

@@ -1554,7 +1554,9 @@ void FileSystemDock::_try_duplicate_item(const FileOrFolder &p_item, const Strin
 void FileSystemDock::_update_resource_paths_after_move(const HashMap<String, String> &p_renames, const HashMap<String, ResourceUID::ID> &p_uids) const {
 void FileSystemDock::_update_resource_paths_after_move(const HashMap<String, String> &p_renames, const HashMap<String, ResourceUID::ID> &p_uids) const {
 	// Update the paths in ResourceUID, so that UIDs remain valid.
 	// Update the paths in ResourceUID, so that UIDs remain valid.
 	for (const KeyValue<String, ResourceUID::ID> &pair : p_uids) {
 	for (const KeyValue<String, ResourceUID::ID> &pair : p_uids) {
-		ResourceUID::get_singleton()->set_id(pair.value, p_renames[pair.key]);
+		if (p_renames.has(pair.key)) {
+			ResourceUID::get_singleton()->set_id(pair.value, p_renames[pair.key]);
+		}
 	}
 	}
 
 
 	// Rename all resources loaded, be it subresources or actual resources.
 	// Rename all resources loaded, be it subresources or actual resources.