mirror of
https://github.com/RobinLinus/snapdrop.git
synced 2025-05-15 23:20:11 -07:00
Don't crash when parsing malformed JSON
This commit is contained in:
parent
72bb4cba1f
commit
993b484396
@ -26,7 +26,12 @@ class SnapdropServer {
|
||||
}
|
||||
|
||||
_onMessage(sender, message) {
|
||||
message = JSON.parse(message);
|
||||
// Try to parse message
|
||||
try {
|
||||
message = JSON.parse(message);
|
||||
} catch (e) {
|
||||
return; // TODO: handle malformed JSON
|
||||
}
|
||||
|
||||
switch (message.type) {
|
||||
case 'disconnect':
|
||||
|
Loading…
x
Reference in New Issue
Block a user