[gjs: 1/2] arg: Avoid segfault when checking for GByteArray



commit 311973184579f0d666083b9d486505c9e94ee2ff
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Jul 29 21:57:46 2018 +0200

    arg: Avoid segfault when checking for GByteArray
    
    JS_IsUnt8Array() doesn't handle NULL, so make sure to only call it
    for non-NULL values.

 gi/arg.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index 180c0872..6b101341 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -1956,7 +1956,7 @@ _Pragma("GCC diagnostic pop")
         /* First, let's handle the case where we're passed an instance
          * of Uint8Array and it needs to be marshalled to GByteArray.
          */
-        if (value.isObjectOrNull()) {
+        if (value.isObject()) {
             JS::RootedObject bytearray_obj(context, value.toObjectOrNull());
             if (JS_IsUint8Array(bytearray_obj) &&
                 array_type == GI_ARRAY_TYPE_BYTE_ARRAY) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]