From 79547896b7639009d8e1941d63788da476f08532 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 21 Dec 2022 14:37:12 +0000 Subject: [PATCH] AK: Replace uses of JsonObject::get_deprecated()/get_ptr() --- AK/JsonPath.cpp | 2 +- AK/JsonValue.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/AK/JsonPath.cpp b/AK/JsonPath.cpp index b681cdf2ee..3a66e7643f 100644 --- a/AK/JsonPath.cpp +++ b/AK/JsonPath.cpp @@ -19,7 +19,7 @@ JsonValue JsonPath::resolve(JsonValue const& top_root) const for (auto const& element : *this) { switch (element.kind()) { case JsonPathElement::Kind::Key: - root = JsonValue { root.as_object().get_deprecated(element.key()) }; + root = JsonValue { root.as_object().get(element.key()).value() }; break; case JsonPathElement::Kind::Index: root = JsonValue { root.as_array().at(element.index()) }; diff --git a/AK/JsonValue.cpp b/AK/JsonValue.cpp index f232b3aa1e..e7cc3562cd 100644 --- a/AK/JsonValue.cpp +++ b/AK/JsonValue.cpp @@ -103,7 +103,11 @@ bool JsonValue::equals(JsonValue const& other) const if (is_object() && other.is_object() && as_object().size() == other.as_object().size()) { bool result = true; as_object().for_each_member([&](auto& key, auto& value) { - result &= value.equals(other.as_object().get_deprecated(key)); + auto other_value = other.as_object().get(key); + if (other_value.has_value()) + result &= value.equals(*other_value); + else + result = false; }); return result; }