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 committed 2021-12-07 16:21:21 +00:00
1 parent a07b8d6c00
commit f1e24945fa
1 file changed
+3 -1
+3 -1
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);