From 04d1407fe81bc474c74ce29da0b388fd33f6150b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 26 Apr 2015 09:14:42 +0200 Subject: update callback wrapper to support bus 2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/native_bus.pyx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/native_bus.pyx b/src/native_bus.pyx index 5cc425c..de33e91 100644 --- a/src/native_bus.pyx +++ b/src/native_bus.pyx @@ -201,9 +201,13 @@ def bus_write_wrapped(bus : int, message : str) -> int: cdef int bus_callback_wrapper(const char *message, user_data): - cdef bytes bs = message + cdef bytes bs callback, user_data = tuple(user_data) - return callback(bs, user_data) + if message is NULL: + return callback(None, user_data) + else: + bs = message + return callback(bs, user_data) def bus_read_wrapped(bus : int, callback : callable, user_data) -> int: -- cgit v1.2.3-70-g09d2