Do not use Dictionary::keys() for Dictionary iteration.

This commit is contained in:
Yufeng Ying 2025-03-21 20:06:01 +08:00
parent 4b36c0491e
commit 8ae16699c5
18 changed files with 78 additions and 102 deletions

View file

@ -708,11 +708,11 @@ void EditorAssetLibrary::_update_repository_options() {
default_urls["godotengine.org (Official)"] = "https://godotengine.org/asset-library/api";
Dictionary available_urls = _EDITOR_DEF("asset_library/available_urls", default_urls, true);
repository->clear();
Array keys = available_urls.keys();
for (int i = 0; i < keys.size(); i++) {
String key = keys[i];
repository->add_item(key);
repository->set_item_metadata(i, available_urls[key]);
int i = 0;
for (const KeyValue<Variant, Variant> &kv : available_urls) {
repository->add_item(kv.key);
repository->set_item_metadata(i, kv.value);
i++;
}
}