diff --git a/js/background.js b/js/background.js index 3b79136f4..747408961 100644 --- a/js/background.js +++ b/js/background.js @@ -334,7 +334,7 @@ Whisper.events.trigger('reconnectTimer'); } else { console.log('offline'); - messageReceiver.close(); + if (messageReceiver) { messageReceiver.close(); } window.addEventListener('online', init); } return; diff --git a/js/backup.js b/js/backup.js index eafd0ff48..d7e584c59 100644 --- a/js/backup.js +++ b/js/backup.js @@ -369,7 +369,7 @@ var jsonString = JSON.stringify(stringify(message)); stream.write(jsonString); - if (attachments.length) { + if (attachments && attachments.length) { var process = function() { return writeAttachments(dir, name, messageId, attachments); };