PostMessage: Catch parsing errors

Change-Id: I844086c8641da5228e7dc817451456f0958be2a6
Reviewed-on: https://gerrit.libreoffice.org/72759
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
Samuel Mehrbrodt 2019-05-22 13:13:10 +02:00
parent 704a6e4cd7
commit 584352dae4

View file

@ -140,7 +140,14 @@ L.Map.WOPI = L.Handler.extend({
return;
}
var msg = JSON.parse(e.data);
var msg;
try {
msg = JSON.parse(e.data);
} catch (e) {
console.error(e);
return;
}
if (msg.MessageId === 'Host_PostmessageReady') {
// We already have a listener for this in loleaflet.html, so ignore it here
return;