summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-08-10 13:49:34 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-10 14:48:45 +0200
commitf6490098874606d0088cb5a4e07fdf719ad30450 (patch)
tree9f6dd9c70e7e4d1e14fce61c81dcead400a66e6a
parentecc8a42cd2c54af2fbd366c2b7298175af31acdc (diff)
downloadserenity-f6490098874606d0088cb5a4e07fdf719ad30450.zip
AK: Don't keep equal JsonObject keys in the order vector twice
Fixes #3069.
-rw-r--r--AK/JsonObject.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/AK/JsonObject.h b/AK/JsonObject.h
index aa177da18d..1c5703e215 100644
--- a/AK/JsonObject.h
+++ b/AK/JsonObject.h
@@ -100,8 +100,9 @@ public:
void set(const String& key, JsonValue value)
{
+ if (m_members.set(key, move(value)) == HashSetResult::ReplacedExistingEntry)
+ m_order.remove(m_order.find_first_index(key).value());
m_order.append(key);
- m_members.set(key, move(value));
}
template<typename Callback>