Skip to content

Commit 64d22bb

Browse files
committed
Ignore unsupported messages to the client
1 parent 6a5d2a1 commit 64d22bb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/client.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ CrossStorageClient.prototype._installListener = function() {
242242
var client = this;
243243

244244
this._listener = function(message) {
245-
var i, error;
245+
var i, error, response;
246246

247247
if (client._closed) return;
248248

@@ -276,7 +276,12 @@ CrossStorageClient.prototype._installListener = function() {
276276
if (message.data === 'ready') return;
277277

278278
// All other messages
279-
var response = JSON.parse(message.data);
279+
try {
280+
response = JSON.parse(message.data);
281+
} catch(e) {
282+
return;
283+
}
284+
280285
if (!response.id) return;
281286

282287
if (client._requests[response.id]) {

0 commit comments

Comments
 (0)