Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/service_interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ ServiceInterface.prototype.call = function(method, message, args) {

// Preparing callback
args = Array.prototype.slice.call(args).concat([ function(err, value) {
var type;
var type = null;

// Error handling
if (err) {
Expand All @@ -112,8 +112,8 @@ ServiceInterface.prototype.call = function(method, message, args) {
return;
}

if (member.out)
type = member.out.type || '';
if (member.out && member.out.type && member.out.type.length > 0 )
type = member.out.type;

self.object.service.bus._sendMessageReply(message, value, type);
} ]);
Expand Down
15 changes: 10 additions & 5 deletions src/object_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ static void _SendMessageReply(DBusConnection* connection, DBusMessage* message,

reply = dbus_message_new_method_return(message);

dbus_message_iter_init_append(reply, &iter);
dbus_signature_iter_init(&siter, signature);
if (!Encoder::EncodeObject(reply_value, &iter, &siter)) {
printf("Failed to encode reply value\n");
if(signature) {
dbus_message_iter_init_append(reply, &iter);
dbus_signature_iter_init(&siter, signature);
if (!Encoder::EncodeObject(reply_value, &iter, &siter)) {
printf("Failed to encode reply value\n");
}
}

// Send reply message
Expand Down Expand Up @@ -169,7 +171,10 @@ NAN_METHOD(SendMessageReply) {
return;
}

char* signature = strdup(*Nan::Utf8String(info[2]));
char* signature = NULL;
if(info[2]->IsString()) {
signature = strdup(*Nan::Utf8String(info[2]));
}
_SendMessageReply(connection, message, info[1], signature);
dbus_free(signature);

Expand Down