ChanViewer: Show "" instead of "undefined" for missing thread subjects
This broke due to a change in JsonValue API. JsonValue::to_string() now returns the value serialized to a string, which may become "undefined". You kinda want JsonValue::as_string(), but that is only callable when the JsonValue *is* a string. Thankfully there is now as_string_or(alt).
This commit is contained in:
parent
9889d170b9
commit
351c354680
Notes:
sideshowbarker
2024-07-19 12:49:59 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/351c354680a
1 changed files with 2 additions and 2 deletions
|
@ -126,9 +126,9 @@ GVariant ThreadCatalogModel::data(const GModelIndex& index, Role role) const
|
|||
case Column::ThreadNumber:
|
||||
return thread.get("no").to_u32();
|
||||
case Column::Subject:
|
||||
return thread.get("sub").to_string();
|
||||
return thread.get("sub").as_string_or({});
|
||||
case Column::Text:
|
||||
return thread.get("com").to_string();
|
||||
return thread.get("com").as_string_or({});
|
||||
case Column::ReplyCount:
|
||||
return thread.get("replies").to_u32();
|
||||
case Column::ImageCount:
|
||||
|
|
Loading…
Add table
Reference in a new issue