diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2014-02-05 10:28:54 +0400 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2014-02-05 10:37:39 +0400 |
commit | 1b64a10fbff65f250685bcd76f81c8597f7b7485 (patch) | |
tree | a762978d778dab16d43a37c2ee40f47ca8a681b2 | |
parent | 9001420d6459c0ea647d5c4e294f63bf3b6d8f9e (diff) |
no error if user cancels torrent file save
-rw-r--r-- | lib/Torrent.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Torrent.js b/lib/Torrent.js index 6d047a0..f6a71ef 100644 --- a/lib/Torrent.js +++ b/lib/Torrent.js @@ -135,8 +135,11 @@ function Torrent (uri, opts) { chrome.fileSystem.chooseEntry({ type: 'saveFile', suggestedName: this.displayName + '.torrent' - }, function (writableFileEntry) { - writableFileEntry.createWriter(function (writer) { + }, function (fileEntry) { + if (!fileEntry) + return + + fileEntry.createWriter(function (writer) { writer.onerror = errorHandler writer.onwriteend = function (e) { console.log('write complete') |