lib/repo-pull: Add a missing precondition
authorPhilip Withnall <withnall@endlessm.com>
Mon, 7 Aug 2017 18:50:40 +0000 (19:50 +0100)
committerAtomic Bot <atomic-devel@projectatomic.io>
Tue, 8 Aug 2017 13:59:58 +0000 (13:59 +0000)
This catches a few failure modes in the pull code a little earlier,
before the incorrectly-NULL repo makes its way into a closure and a
worker thread, where the cause of the problem is harder to track down.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #1058
Approved by: cgwalters

src/libostree/ostree-repo-pull.c

index ed616a81a4d442c2db27222efde78016bf5053be..8c0c4ff18071cc548227377e42c415eb33a18e9c 100644 (file)
@@ -3270,6 +3270,7 @@ ostree_repo_pull_with_options (OstreeRepo             *self,
       (void) g_variant_lookup (options, "localcache-repos", "^a&s", &opt_localcache_repos);
     }
 
+  g_return_val_if_fail (OSTREE_IS_REPO (self), FALSE);
   g_return_val_if_fail (pull_data->maxdepth >= -1, FALSE);
   g_return_val_if_fail (!opt_collection_refs_set ||
                         (refs_to_fetch == NULL && override_commit_ids == NULL), FALSE);