summaryrefslogtreecommitdiff
path: root/gi
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2009-12-03 19:33:21 -0200
committerJohan Dahlin <johan@gnome.org>2009-12-03 19:47:17 -0200
commite2fe272a26e17a413b74178d48136be1108ff2a0 (patch)
treebd6fc32e130c880405638dd64757b3a072a22c68 /gi
parenta14aa201198bcaa85e3d58582fb2d55ecebca3d3 (diff)
downloadgjs-e2fe272a26e17a413b74178d48136be1108ff2a0.tar.gz
Allow null/undefined to be passed in to callbacks
Some functions do not require a callback to be passed in, instead NULL is accepted, the same should be supported in gjs by allowing null/undefined. https://bugzilla.gnome.org/show_bug.cgi?id=603735
Diffstat (limited to 'gi')
-rw-r--r--gi/function.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gi/function.c b/gi/function.c
index 5d403e8a..09bb09ff 100644
--- a/gi/function.c
+++ b/gi/function.c
@@ -382,6 +382,11 @@ gjs_callback_from_arguments(JSContext *context,
if (is_notify)
goto out;
+ if (JSVAL_IS_NULL(argv[*argv_pos]) || JSVAL_IS_VOID(argv[*argv_pos])) {
+ *closure = NULL;
+ return TRUE;
+ }
+
invoke_info = gjs_callback_invoke_prepare(context,
argv[*argv_pos],
(GICallableInfo*)interface_info);