sysroot: Add precondition that load() has been called for some API calls

We require the caller to invoke load() at the moment to do most
things.
This commit is contained in:
Colin Walters 2014-08-15 15:21:40 -04:00
parent 82fb07e4ae
commit 6a55d2c32f
1 changed files with 7 additions and 1 deletions

View File

@ -755,6 +755,8 @@ ostree_sysroot_get_subbootversion (OstreeSysroot *self)
OstreeDeployment *
ostree_sysroot_get_booted_deployment (OstreeSysroot *self)
{
g_return_val_if_fail (self->loaded, NULL);
return self->booted_deployment;
}
@ -767,8 +769,12 @@ ostree_sysroot_get_booted_deployment (OstreeSysroot *self)
GPtrArray *
ostree_sysroot_get_deployments (OstreeSysroot *self)
{
GPtrArray *copy = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref);
GPtrArray *copy;
guint i;
g_return_val_if_fail (self->loaded, NULL);
copy = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref);
for (i = 0; i < self->deployments->len; i++)
g_ptr_array_add (copy, g_object_ref (self->deployments->pdata[i]));
return copy;