lib/repo: assert that writable state and error agree

This adds an assertion to check that writable stable and error
are in sync. The subsequent logic uses them interchangeably.
This commit is contained in:
Luca BRUNO 2021-12-07 16:13:54 +00:00
parent a07b8d6c00
commit f1e24945fa
No known key found for this signature in database
GPG Key ID: A9834A2252078E4E
1 changed files with 3 additions and 1 deletions

View File

@ -1560,8 +1560,10 @@ gboolean
ostree_repo_is_writable (OstreeRepo *self,
GError **error)
{
g_return_val_if_fail (self->inited, FALSE);
g_assert (self != NULL);
g_assert (self->inited);
g_assert (self->writable == (self->writable_error == NULL));
if (error != NULL && self->writable_error != NULL)
*error = g_error_copy (self->writable_error);