From 0c7bc34ca1b540c40320244da7f711c94a021111 Mon Sep 17 00:00:00 2001 From: Phaedrus Leeds Date: Fri, 11 Sep 2020 18:17:10 -0700 Subject: Avoid critical error in remote-info command Without this patch, the remote-info command will sometimes emit a critical error "g_utf8_strlen: assertion 'p != NULL || max == 0' failed" and print (null) for the "Commit:" field, since the commit doesn't get initialized properly. (cherry picked from commit 238317d99b22c533f4344cf9963b7914053d01a3) --- common/flatpak-dir.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index 065f572f..910bfb16 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -989,14 +989,14 @@ flatpak_remote_state_load_ref_commit (FlatpakRemoteState *self, /* First try local availability */ if (ostree_repo_load_commit (dir->repo, commit, &commit_data, NULL, NULL)) - return g_steal_pointer (&commit_data); + goto out; for (int i = 0; i < self->sideload_repos->len; i++) { FlatpakSideloadState *ss = g_ptr_array_index (self->sideload_repos, i); if (ostree_repo_load_commit (ss->repo, commit, &commit_data, NULL, NULL)) - return g_steal_pointer (&commit_data); + goto out; } if (flatpak_dir_get_remote_oci (dir, self->remote_name)) @@ -1006,6 +1006,7 @@ flatpak_remote_state_load_ref_commit (FlatpakRemoteState *self, commit_data = flatpak_remote_state_fetch_commit_object (self, dir, ref, commit, token, cancellable, error); +out: if (out_commit) *out_commit = g_steal_pointer (&commit); -- cgit v1.2.1