summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2013-02-20 14:40:41 +0100
committerPierre Rossi <pierre.rossi@gmail.com>2013-11-01 13:57:49 +0100
commit211f8ac57b6718dd36691ac34326e9aa405664b6 (patch)
tree38d657823ab0aec15f0cc2e6324f929c2f78a5b4 /src
parentb2eeff74bc4e0e003bc01bf108c9d90dd6794606 (diff)
downloadqtwebchannel-211f8ac57b6718dd36691ac34326e9aa405664b6.tar.gz
Properly support void-returning method invocations
Change-Id: Ic0d9f536eee4e328fb4456fce7b84019dd7ff744 Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/webchannel.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/webchannel.js b/src/webchannel.js
index d3521ad..37e2314 100644
--- a/src/webchannel.js
+++ b/src/webchannel.js
@@ -65,10 +65,13 @@ var QWebChannel = function(baseUrl, initCallback)
this.socket.onmessage = function(message)
{
var jsonData = JSON.parse(message.data);
- if (jsonData.id === undefined || jsonData.data === undefined) {
+ if (jsonData.id === undefined) {
console.error("invalid message received:", message.data);
return;
}
+ if (jsonData.data === undefined) {
+ jsonData.data = {};
+ }
if (jsonData.response) {
channel.execCallbacks[jsonData.id](jsonData.data);
delete channel.execCallbacks[jsonData.id];