瀏覽代碼

Use validated key in Dictionary::has

Updated Dictionary::has to use validated key when checking variant_map, to handle cases when passed in key is converted to Dictionary's key type.
aaronp64 5 月之前
父節點
當前提交
117b1c3da1
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      core/variant/dictionary.cpp

+ 1 - 1
core/variant/dictionary.cpp

@@ -218,7 +218,7 @@ bool Dictionary::is_empty() const {
 bool Dictionary::has(const Variant &p_key) const {
 	Variant key = p_key;
 	ERR_FAIL_COND_V(!_p->typed_key.validate(key, "use 'has'"), false);
-	return _p->variant_map.has(p_key);
+	return _p->variant_map.has(key);
 }
 
 bool Dictionary::has_all(const Array &p_keys) const {