[libgit2-glib] ggit_diff_foreach: Prevent assertions with null callbacks
- From: Alberto Fanjul <albfan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgit2-glib] ggit_diff_foreach: Prevent assertions with null callbacks
- Date: Fri, 24 Jun 2022 17:58:40 +0000 (UTC)
commit da13787becefd6a546ef3bc431facce379ffa0fb
Author: David Hewitt <davidmhewitt gmail com>
Date: Wed Mar 30 16:22:30 2022 +0000
ggit_diff_foreach: Prevent assertions with null callbacks
These callbacks are marked as `allow-none`, so `NULL` should be allowed for them. But the method does
nothing if we don't supply any callbacks, so presumably that's what this assert was intended for. However, it
currently fails if ANY of the callbacks are `NULL`, we only want it to fail if ALL of the callbacks are
`NULL`.
libgit2-glib/ggit-diff.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/libgit2-glib/ggit-diff.c b/libgit2-glib/ggit-diff.c
index 06e0657..6e09568 100644
--- a/libgit2-glib/ggit-diff.c
+++ b/libgit2-glib/ggit-diff.c
@@ -670,7 +670,7 @@ ggit_diff_foreach (GgitDiff *diff,
git_diff_line_cb real_line_cb = NULL;
g_return_if_fail (GGIT_IS_DIFF (diff));
- g_return_if_fail (file_cb != NULL && binary_cb != NULL && hunk_cb != NULL && line_cb != NULL);
+ g_return_if_fail (file_cb != NULL || binary_cb != NULL || hunk_cb != NULL || line_cb != NULL);
g_return_if_fail (error == NULL || *error == NULL);
wrapper_data_init (&wrapper_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]