mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Utilities/fortune: Replace uses of JsonObject::get_deprecated()/get_ptr
This commit is contained in:
parent
609a123c43
commit
08c26e988a
Notes:
sideshowbarker
2024-07-17 00:51:21 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/08c26e988a Pull-request: https://github.com/SerenityOS/serenity/pull/16627 Reviewed-by: https://github.com/trflynn89
1 changed files with 6 additions and 7 deletions
|
@ -27,16 +27,15 @@ public:
|
|||
return {};
|
||||
auto& entry = value.as_object();
|
||||
Quote q;
|
||||
if (!entry.has("quote"sv) || !entry.has("author"sv) || !entry.has("utc_time"sv) || !entry.has("url"sv))
|
||||
if (!entry.has_string("quote"sv) || !entry.has_string("author"sv) || !entry.has_u64("utc_time"sv) || !entry.has_string("url"sv))
|
||||
return {};
|
||||
// From here on, trust that it's probably fine.
|
||||
q.m_quote = entry.get_deprecated("quote"sv).as_string();
|
||||
q.m_author = entry.get_deprecated("author"sv).as_string();
|
||||
// It is sometimes parsed as u32, sometimes as u64, depending on how large the number is.
|
||||
q.m_utc_time = entry.get_deprecated("utc_time"sv).to_number<u64>();
|
||||
q.m_url = entry.get_deprecated("url"sv).as_string();
|
||||
q.m_quote = entry.get_deprecated_string("quote"sv).value();
|
||||
q.m_author = entry.get_deprecated_string("author"sv).value();
|
||||
q.m_utc_time = entry.get_u64("utc_time"sv).value();
|
||||
q.m_url = entry.get_deprecated_string("url"sv).value();
|
||||
if (entry.has("context"sv))
|
||||
q.m_context = entry.get_deprecated("context"sv).as_string();
|
||||
q.m_context = entry.get_deprecated_string("context"sv).value();
|
||||
|
||||
return q;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue