[ostree] pull-local: Don't call g_hash_table_init() on a NULL hash
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] pull-local: Don't call g_hash_table_init() on a NULL hash
- Date: Sat, 23 Feb 2013 16:15:53 +0000 (UTC)
commit 99fe7b66b3f9e1accbc592679e8f2fed156306ea
Author: Colin Walters <walters verbum org>
Date: Sat Feb 23 11:15:19 2013 -0500
pull-local: Don't call g_hash_table_init() on a NULL hash
Not sure why this wasn't crashing before.
src/ostree/ot-builtin-pull-local.c | 28 +++++++++++++++++-----------
1 files changed, 17 insertions(+), 11 deletions(-)
---
diff --git a/src/ostree/ot-builtin-pull-local.c b/src/ostree/ot-builtin-pull-local.c
index 9fe8a37..36719ea 100644
--- a/src/ostree/ot-builtin-pull-local.c
+++ b/src/ostree/ot-builtin-pull-local.c
@@ -241,22 +241,28 @@ ostree_builtin_pull_local (int argc, char **argv, GFile *repo_path, GError **err
source_objects = ostree_traverse_new_reachable ();
- g_hash_table_iter_init (&hash_iter, refs_to_clone);
- while (g_hash_table_iter_next (&hash_iter, &key, &value))
+ if (refs_to_clone)
{
- const char *checksum = value;
-
- if (!ostree_traverse_commit (data->src_repo, checksum, 0, source_objects, cancellable, error))
- goto out;
+ g_hash_table_iter_init (&hash_iter, refs_to_clone);
+ while (g_hash_table_iter_next (&hash_iter, &key, &value))
+ {
+ const char *checksum = value;
+
+ if (!ostree_traverse_commit (data->src_repo, checksum, 0, source_objects, cancellable, error))
+ goto out;
+ }
}
- g_hash_table_iter_init (&hash_iter, commits_to_clone);
- while (g_hash_table_iter_next (&hash_iter, &key, &value))
+ if (commits_to_clone)
{
- const char *checksum = key;
+ g_hash_table_iter_init (&hash_iter, commits_to_clone);
+ while (g_hash_table_iter_next (&hash_iter, &key, &value))
+ {
+ const char *checksum = key;
- if (!ostree_traverse_commit (data->src_repo, checksum, 0, source_objects, cancellable, error))
- goto out;
+ if (!ostree_traverse_commit (data->src_repo, checksum, 0, source_objects, cancellable, error))
+ goto out;
+ }
}
if (!ostree_repo_prepare_transaction (data->dest_repo, FALSE, cancellable, error))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]