diff --git a/AK/JsonObject.h b/AK/JsonObject.h index a69d2255b9..54a50627cf 100644 --- a/AK/JsonObject.h +++ b/AK/JsonObject.h @@ -41,11 +41,17 @@ public: bool is_empty() const { return m_members.is_empty(); } JsonValue get(const String& key) const + { + auto* value = get_ptr(key); + return value ? *value : JsonValue(JsonValue::Type::Undefined); + } + + const JsonValue* get_ptr(const String& key) const { auto it = m_members.find(key); if (it == m_members.end()) - return JsonValue(JsonValue::Type::Undefined); - return (*it).value; + return nullptr; + return &(*it).value; } bool has(const String& key) const