[dconf] mock dbus: allow for NULL replies in case of error



commit 3c6ef28a349bf7b1e824139df3552111db61b3be
Author: Ryan Lortie <desrt desrt ca>
Date:   Mon Nov 25 00:29:30 2013 -0500

    mock dbus: allow for NULL replies in case of error
    
    But make sure an error is set if NULL is returned and the caller passed
    in an error pointer.

 tests/dconf-mock-dbus.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/tests/dconf-mock-dbus.c b/tests/dconf-mock-dbus.c
index 1ae7ba0..e20b61a 100644
--- a/tests/dconf-mock-dbus.c
+++ b/tests/dconf-mock-dbus.c
@@ -65,5 +65,7 @@ dconf_engine_dbus_call_sync_func (GBusType             bus_type,
 
   g_variant_unref (parameters);
 
-  return g_variant_take_ref (reply);
+  g_assert (reply != NULL || (error == NULL || *error != NULL));
+
+  return reply ? g_variant_take_ref (reply) : NULL;
 }


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