diff options
Diffstat (limited to 'src/webchannel.js')
-rw-r--r-- | src/webchannel.js | 5 |
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]; |