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 <withnall@endlessm.com>
tingping/wmclass
Philip Withnall 2017-08-01 16:41:13 +01:00 committed by Alexander Larsson
parent bc0f90764e
commit 358e204fb3
1 changed files with 8 additions and 5 deletions

View File

@ -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;