summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2023-02-08 18:24:01 +0000
committerSimon McVittie <smcv@collabora.com>2023-02-08 21:14:17 +0000
commit5e2e771ece06f37b3f9f60089ede718fa8bcaf8e (patch)
tree3a040e577a28278599d006458437f04a367fa639
parent5b2295508fd3c85f1d82ed1cd073968af775b59b (diff)
downloadflatpak-5e2e771ece06f37b3f9f60089ede718fa8bcaf8e.tar.gz
list: Handle error in flatpak_dir_load_deployed()
flatpak_dir_load_deployed() can fail and return NULL. If that happens, there is a semi-installed but broken app, and we should show a warning rather than crashing. Resolves: https://github.com/flatpak/flatpak/issues/5293 Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r--app/flatpak-builtins-list.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/app/flatpak-builtins-list.c b/app/flatpak-builtins-list.c
index 50b93e42..7b3edd20 100644
--- a/app/flatpak-builtins-list.c
+++ b/app/flatpak-builtins-list.c
@@ -154,6 +154,7 @@ print_table_for_refs (gboolean print_apps,
const char *repo = NULL;
g_autoptr(FlatpakDeploy) deploy = NULL;
g_autoptr(GBytes) deploy_data = NULL;
+ g_autoptr(GError) local_error = NULL;
const char *active;
const char *alt_id;
const char *eol;
@@ -171,7 +172,16 @@ print_table_for_refs (gboolean print_apps,
if (arch != NULL && !flatpak_decomposed_is_arch (ref, arch))
continue;
- deploy = flatpak_dir_load_deployed (dir, ref, NULL, cancellable, NULL);
+ deploy = flatpak_dir_load_deployed (dir, ref, NULL, cancellable, &local_error);
+
+ if (deploy == NULL)
+ {
+ g_warning (_("Unable to load details of %s: %s"),
+ partial_ref, local_error->message);
+ g_clear_error (&local_error);
+ continue;
+ }
+
deploy_data = flatpak_deploy_get_deploy_data (deploy, FLATPAK_DEPLOY_VERSION_CURRENT, cancellable, NULL);
if (deploy_data == NULL)
continue;