From 358e204fb30aef4097d4be0c2fef60394dc37092 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 1 Aug 2017 16:41:13 +0100 Subject: [PATCH] common/dir: Handle NULL out parameter correctly when getting config ostree_repo_get_remote_option() requires the out parameter to be non-NULL. Signed-off-by: Philip Withnall --- common/flatpak-dir.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index 81aed154..8ff1fa06 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -1867,11 +1867,14 @@ repo_get_remote_collection_id (OstreeRepo *repo, GError **error) { #ifdef FLATPAK_ENABLE_P2P - if (!ostree_repo_get_remote_option (repo, remote_name, "collection-id", - NULL, collection_id_out, error)) - return FALSE; - if (collection_id_out != NULL && *collection_id_out != NULL && **collection_id_out == '\0') - g_clear_pointer (collection_id_out, g_free); + if (collection_id_out != NULL) + { + if (!ostree_repo_get_remote_option (repo, remote_name, "collection-id", + NULL, collection_id_out, error)) + return FALSE; + if (*collection_id_out != NULL && **collection_id_out == '\0') + g_clear_pointer (collection_id_out, g_free); + } #else /* if !FLATPAK_ENABLE_P2P */ if (collection_id_out != NULL) *collection_id_out = NULL;