[gnode] value: Don't pass undefined nonsense to function



commit 0acf0a0b9a4e72ddddce10acff00339a90051e36
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Nov 27 16:50:15 2015 -0800

    value: Don't pass undefined nonsense to function
    
    We need to figure out how to try/catch this exception, but for now, just
    fill the slot with NULL so that the GLib guards catch most of it.

 src/value.cc |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/value.cc b/src/value.cc
index 16129e5..34e7419 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -123,9 +123,9 @@ void V8ToGIArgument(GITypeInfo *type_info, GIArgument *arg, Handle<Value> value,
     GITypeTag type_tag = g_type_info_get_tag (type_info);
 
     if (value->IsNull ()) {
-        if (may_be_null)
-            arg->v_pointer = NULL;
-        else
+        arg->v_pointer = NULL;
+
+        if (!may_be_null)
             ThrowException (Exception::TypeError (String::New ("Argument may not be null.")));
 
         return;


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