mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2026-04-18 15:22:16 +00:00
Don't crash when parsing malformed JSON
This commit is contained in:
@@ -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':
|
||||
|
||||
Reference in New Issue
Block a user