From 351c354680a8c9d8b1efa01fd9bed53393d8ab73 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 7 Aug 2019 22:04:07 +0200 Subject: [PATCH] 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). --- Applications/ChanViewer/ThreadCatalogModel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Applications/ChanViewer/ThreadCatalogModel.cpp b/Applications/ChanViewer/ThreadCatalogModel.cpp index b1cefaf5fc4..5e7f998f42c 100644 --- a/Applications/ChanViewer/ThreadCatalogModel.cpp +++ b/Applications/ChanViewer/ThreadCatalogModel.cpp @@ -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: