[gjs] Fix (allow-none) for arrays
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] Fix (allow-none) for arrays
- Date: Sat, 9 Jul 2011 14:04:36 +0000 (UTC)
commit 4f63f43e407fc050df31acf14a4b56bb2295d58b
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Tue Jul 5 19:28:46 2011 +0200
Fix (allow-none) for arrays
Previous check rejected non-string and non-object in all cases,
even when null was allowed.
https://bugzilla.gnome.org/show_bug.cgi?id=652753
gi/arg.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gi/arg.c b/gi/arg.c
index c224388..0bde47e 100644
--- a/gi/arg.c
+++ b/gi/arg.c
@@ -862,7 +862,8 @@ gjs_array_to_explicit_array_internal(JSContext *context,
param_tag = GI_TYPE_TAG_UINT8;
}
- if ((JSVAL_IS_NULL(value) && !may_be_null) || (!JSVAL_IS_STRING(value) && !JSVAL_IS_OBJECT(value))) {
+ if ((JSVAL_IS_NULL(value) && !may_be_null) ||
+ (!JSVAL_IS_STRING(value) && !JSVAL_IS_OBJECT(value) && !JSVAL_IS_NULL(value))) {
gchar *display_name = get_argument_display_name(arg_name, arg_type);
gjs_throw(context, "Expected type %s for %s but got type '%s' %p",
g_type_tag_to_string(param_tag),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]