Skip to content

Commit 7c6d0d8

Browse files
committed
Merge pull request godotengine#101441 from KoBeWi/what_happened_to_your_uid,_why_is_it_so_invalid
Improve missing UID errors
2 parents 3865598 + d3d874e commit 7c6d0d8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

core/io/resource_uid.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,14 @@ void ResourceUID::set_id(ID p_id, const String &p_path) {
151151
}
152152

153153
String ResourceUID::get_id_path(ID p_id) const {
154+
ERR_FAIL_COND_V_MSG(p_id == INVALID_ID, String(), "Invalid UID.");
154155
MutexLock l(mutex);
155-
ERR_FAIL_COND_V(!unique_ids.has(p_id), String());
156-
const CharString &cs = unique_ids[p_id].cs;
156+
const ResourceUID::Cache *cache = unique_ids.getptr(p_id);
157+
ERR_FAIL_COND_V_MSG(!cache, String(), vformat("Unrecognized UID: \"%s\".", id_to_text(p_id)));
158+
const CharString &cs = cache->cs;
157159
return String::utf8(cs.ptr());
158160
}
161+
159162
void ResourceUID::remove_id(ID p_id) {
160163
MutexLock l(mutex);
161164
ERR_FAIL_COND(!unique_ids.has(p_id));

0 commit comments

Comments
 (0)