daemon: only add base-checksum if pkgs layered

The origin might have an empty "requested" key in the "packages"
section, which is probably an indication that packages were once added
but were then removed.

Explicitly check the length of the pkg array in case it's actually
empty before adding the base-checksum to the deployment variant.

Closes: #371
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon 2016-06-29 15:07:16 -04:00 committed by Atomic Bot
parent 5fb4a04e85
commit 8c76381a97

View File

@ -223,7 +223,7 @@ rpmostreed_deployment_generate_variant (OstreeDeployment *deployment,
g_variant_dict_insert (&dict, "osname", "s", osname); g_variant_dict_insert (&dict, "osname", "s", osname);
g_variant_dict_insert (&dict, "serial", "i", serial); g_variant_dict_insert (&dict, "serial", "i", serial);
g_variant_dict_insert (&dict, "checksum", "s", csum); g_variant_dict_insert (&dict, "checksum", "s", csum);
if (origin_packages) if (origin_packages != NULL && g_strv_length (origin_packages) > 0)
{ {
const char *parent = ostree_commit_get_parent (commit); const char *parent = ostree_commit_get_parent (commit);
g_assert (parent); g_assert (parent);