[gjs] jsapi-util: Pass NULL vp array if no ARGV elements
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] jsapi-util: Pass NULL vp array if no ARGV elements
- Date: Sat, 19 Nov 2016 05:50:33 +0000 (UTC)
commit 97298dafa99fc9db7e4d16e20709cbd10c9c6022
Author: Philip Chimento <philip chimento gmail com>
Date: Fri Nov 18 21:46:52 2016 -0800
jsapi-util: Pass NULL vp array if no ARGV elements
This used to work with an unrooted JS::Value* vp array, but now that we
are using JS::AutoValueVector we can't index argv[0] if the size of the
vector is 0. Pass NULL instead.
(Unreviewed, but it's another instance of the same fix as [e329af899].)
gjs/jsapi-util.cpp | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 81f97b9..f68440a 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -316,7 +316,8 @@ gjs_build_string_array(JSContext *context,
elems.append(element);
}
- return JS_NewArrayObject(context, elems.length(), &elems[0]);
+ return JS_NewArrayObject(context, elems.length(),
+ elems.length() ? &elems[0] : NULL);
}
JSObject*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]