Include key in Dictionary::operator[] error message

Include key in error message when lookup fails
This commit is contained in:
aaronp64
2025-11-16 11:21:49 -05:00
parent ef34c3d534
commit c18332740c

View File

@ -133,7 +133,7 @@ const Variant &Dictionary::operator[](const Variant &p_key) const {
} else { } else {
static Variant empty; static Variant empty;
const Variant *value = _p->variant_map.getptr(key); const Variant *value = _p->variant_map.getptr(key);
ERR_FAIL_COND_V_MSG(!value, empty, "Bug: Dictionary::operator[] used when there was no value for the given key, please report."); ERR_FAIL_COND_V_MSG(!value, empty, vformat(R"(Bug: Dictionary::operator[] used when there was no value for the given key "%s". Please report.)", key));
return *value; return *value;
} }
} }