mirror of
https://github.com/flatpak/flatpak.git
synced 2026-02-05 21:41:22 -05:00
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>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user