Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Fix *HashMap::replace_key comparison

Brogolem358da879c6ba97
diff --git a/core/templates/a_hash_map.h b/core/templates/a_hash_map.h
index 71251d73116..39f04054d4e 100644
--- a/core/templates/a_hash_map.h
+++ b/core/templates/a_hash_map.h
@@ -359,7 +359,7 @@ public:
// Replace the key of an entry in-place, without invalidating iterators or changing the entries position during iteration.
// p_old_key must exist in the map and p_new_key must not, unless it is equal to p_old_key.
bool replace_key(const TKey &p_old_key, const TKey &p_new_key) {
- if (p_old_key == p_new_key) {
+ if (Comparator::compare(p_old_key, p_new_key)) {
return true;
}
uint32_t meta_idx = 0;
diff --git a/core/templates/hash_map.h b/core/templates/hash_map.h
index 963d5857f45..ae5c82fad4b 100644
--- a/core/templates/hash_map.h
+++ b/core/templates/hash_map.h
@@ -380,7 +380,7 @@ public:
// p_old_key must exist in the map and p_new_key must not, unless it is equal to p_old_key.
bool replace_key(const TKey &p_old_key, const TKey &p_new_key) {
ERR_FAIL_COND_V(_elements == nullptr || _size == 0, false);
- if (p_old_key == p_new_key) {
+ if (Comparator::compare(p_old_key, p_new_key)) {
return true;
}
const uint32_t new_hash = _hash(p_new_key);