summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhaedrus Leeds <matthew.leeds@endlessm.com>2020-09-11 18:17:10 -0700
committerPhaedrus Leeds <mwleeds@endlessos.org>2020-11-09 09:30:29 -0800
commit0c7bc34ca1b540c40320244da7f711c94a021111 (patch)
tree3e40e087e8ea6ba6ce9fddb09a6d2c800e99ddc3
parent7d23cdbea48d21950d746ce6be69fbcd774dad4a (diff)
downloadflatpak-backport-remote-info-fix.tar.gz
Avoid critical error in remote-info commandbackport-remote-info-fix
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)
-rw-r--r--common/flatpak-dir.c5
1 files 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);