lib/repo-refs: properly return an error value
authorLuca BRUNO <luca.bruno@coreos.com>
Wed, 26 Oct 2022 11:12:37 +0000 (11:12 +0000)
committerLuca BRUNO <luca.bruno@coreos.com>
Wed, 26 Oct 2022 11:12:52 +0000 (11:12 +0000)
This tweaks a logic check in order to return a proper error value
when the related condition is not satisfied.

src/libostree/ostree-repo-refs.c

index 86bd27c536a5684813d87c3183dad31b8228fd69..9ac2cc098605a807ef1e1af1f1e98c01b34e59e4 100644 (file)
@@ -36,7 +36,8 @@ add_ref_to_set (const char       *remote,
                 GCancellable     *cancellable,
                 GError          **error)
 {
-  g_return_val_if_fail (remote == NULL || collection_id == NULL, FALSE);
+  if (remote != NULL && collection_id != NULL)
+    return glnx_throw (error, "Cannot process both a remote and a collection ID");
 
   gsize len;
   char *contents = glnx_file_get_contents_utf8_at (base_fd, path, &len, cancellable, error);