From edcfcd21a3e751f4676c8b19a8356fde36c8a3d1 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 26 Sep 2013 13:57:59 -0400 Subject: [PATCH] show: Print an error message if commit doesn't have detached metadata ...instead of segfaulting. --- src/ostree/ot-builtin-show.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ostree/ot-builtin-show.c b/src/ostree/ot-builtin-show.c index 09aaead7..859c3d14 100644 --- a/src/ostree/ot-builtin-show.c +++ b/src/ostree/ot-builtin-show.c @@ -124,6 +124,12 @@ do_print_metadata_key (OstreeRepo *repo, if (!ostree_repo_read_commit_detached_metadata (repo, resolved_rev, &metadata, NULL, error)) goto out; + if (metadata == NULL) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, + "No detached metadata for commit %s", resolved_rev); + goto out; + } } if (!g_variant_lookup (metadata, key, "&s", &value))