From 41a967c8af03826e4ec2e5f2fb644cb4be118ad5 Mon Sep 17 00:00:00 2001 From: Alexander Vanhee <160625516+AlexanderVanhee@users.noreply.github.com> Date: Wed, 12 Nov 2025 23:55:42 +0100 Subject: [PATCH] (Bug) handle apps without stats better --- src/bz-entry.c | 9 +++++++++ src/bz-full-view.blp | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/bz-entry.c b/src/bz-entry.c index 221e3e51..b89aa861 100644 --- a/src/bz-entry.c +++ b/src/bz-entry.c @@ -2141,6 +2141,15 @@ query_flathub_fiber (QueryFlathubData *data) JsonObject *per_day = NULL; g_autoptr (GListStore) store = NULL; + if (!JSON_NODE_HOLDS_OBJECT (node)) + { + g_debug ("No data for property %s for %s from flathub", + props[prop]->name, id); + return dex_future_new_for_error ( + g_error_new (G_IO_ERROR, G_IO_ERROR_INVALID_DATA, + "Unexpected JSON response format")); + } + per_day = json_object_get_object_member ( json_node_get_object (node), "installs_per_day"); diff --git a/src/bz-full-view.blp b/src/bz-full-view.blp index 9b776a8f..b2b76f01 100644 --- a/src/bz-full-view.blp +++ b/src/bz-full-view.blp @@ -452,9 +452,10 @@ template $BzFullView: Adw.Bin { $BzContextTile { can-target: bind $invert_boolean($is_null(template.debounced-ui-entry) as ) as ; + sensitive: bind $invert_boolean($is_null(template.debounced-ui-entry as <$BzResult>.object as <$BzEntry>.recent-downloads) as ) as ; clicked => $dl_stats_cb(template); label: _("Downloads /mo"); - has-tooltip: true; + has-tooltip: bind $invert_boolean($is_null(template.debounced-ui-entry as <$BzResult>.object as <$BzEntry>.recent-downloads) as ) as ; tooltip-text: bind $format_recent_downloads_tooltip(template.debounced-ui-entry as <$BzResult>.object as <$BzEntry>.recent-downloads) as ; lozenge-style: "grey";