You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
Merge pull request #104432 from YYF233333/dict_iter2
Do not iterate `Dictionary` with `Dictionary::keys()`
This commit is contained in:
@@ -1343,16 +1343,16 @@ static bool compare_value(const String &p_path, const String &p_field, const Var
|
||||
} else if (p_old_value.get_type() == Variant::DICTIONARY && p_new_value.get_type() == Variant::DICTIONARY) {
|
||||
Dictionary old_dict = p_old_value;
|
||||
Dictionary new_dict = p_new_value;
|
||||
for (const Variant &key : old_dict.keys()) {
|
||||
if (!new_dict.has(key)) {
|
||||
for (const KeyValue<Variant, Variant> &kv : old_dict) {
|
||||
if (!new_dict.has(kv.key)) {
|
||||
failed = true;
|
||||
print_error(vformat("Validate extension JSON: Error: Field '%s': %s was removed.", p_path, key));
|
||||
print_error(vformat("Validate extension JSON: Error: Field '%s': %s was removed.", p_path, kv.key));
|
||||
continue;
|
||||
}
|
||||
if (p_allow_name_change && key == "name") {
|
||||
if (p_allow_name_change && kv.key == "name") {
|
||||
continue;
|
||||
}
|
||||
if (!compare_value(path, key, old_dict[key], new_dict[key], p_allow_name_change)) {
|
||||
if (!compare_value(path, kv.key, kv.value, new_dict[kv.key], p_allow_name_change)) {
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user