Don't crash when parsing malformed JSON
This commit is contained in:
parent
72bb4cba1f
commit
993b484396
1 changed files with 8 additions and 3 deletions
|
@ -26,7 +26,12 @@ class SnapdropServer {
|
|||
}
|
||||
|
||||
_onMessage(sender, message) {
|
||||
// Try to parse message
|
||||
try {
|
||||
message = JSON.parse(message);
|
||||
} catch (e) {
|
||||
return; // TODO: handle malformed JSON
|
||||
}
|
||||
|
||||
switch (message.type) {
|
||||
case 'disconnect':
|
||||
|
|
Loading…
Reference in a new issue