From 24ac5af5b418edea43f7a9cc2c0f59d2a29a2c27 Mon Sep 17 00:00:00 2001 From: DC Date: Mon, 22 Aug 2016 00:20:15 -0700 Subject: [PATCH 1/2] Fix jumpToTime Fixes #801 --- src/renderer/controllers/playback-controller.js | 4 ++++ src/renderer/lib/cast.js | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/renderer/controllers/playback-controller.js b/src/renderer/controllers/playback-controller.js index c1781895..4bdadf76 100644 --- a/src/renderer/controllers/playback-controller.js +++ b/src/renderer/controllers/playback-controller.js @@ -93,6 +93,10 @@ module.exports = class PlaybackController { // Skip (aka seek) to a specific point, in seconds skipTo (time) { + if (!Number.isFinite(time)) { + console.error('Tried to skip to a non-finite time ' + time) + return console.trace() + } if (isCasting(this.state)) Cast.seek(time) else this.state.playing.jumpToTime = time } diff --git a/src/renderer/lib/cast.js b/src/renderer/lib/cast.js index 2bb8dc2c..180c833e 100644 --- a/src/renderer/lib/cast.js +++ b/src/renderer/lib/cast.js @@ -396,7 +396,9 @@ function stop () { function stoppedCasting () { state.playing.location = 'local' - state.playing.jumpToTime = state.playing.currentTime + state.playing.jumpToTime = Number.isFinite(state.playing.currentTime) + ? state.playing.currentTime + : 0 update() } From e872282221d03c6d5aae0f14b91ff931c5dfdab0 Mon Sep 17 00:00:00 2001 From: DC Date: Mon, 22 Aug 2016 00:43:06 -0700 Subject: [PATCH 2/2] Fix Delete Torrent + Data for newly added magnet links Before, if you added a magnet link and then tried to delete the torrent plus data before the file list was loaded, it would fail and throw an uncaught error Fixes #803 --- src/renderer/controllers/torrent-list-controller.js | 2 +- src/renderer/lib/torrent-summary.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/renderer/controllers/torrent-list-controller.js b/src/renderer/controllers/torrent-list-controller.js index 5ad278e2..dc9fe9cc 100644 --- a/src/renderer/controllers/torrent-list-controller.js +++ b/src/renderer/controllers/torrent-list-controller.js @@ -263,7 +263,7 @@ function deleteFile (path) { // Delete all files in a torrent function moveItemToTrash (torrentSummary) { var filePath = TorrentSummary.getFileOrFolder(torrentSummary) - ipcRenderer.send('moveItemToTrash', filePath) + if (filePath) ipcRenderer.send('moveItemToTrash', filePath) } function showItemInFolder (torrentSummary) { diff --git a/src/renderer/lib/torrent-summary.js b/src/renderer/lib/torrent-summary.js index fd5b0d80..9b0e3c6a 100644 --- a/src/renderer/lib/torrent-summary.js +++ b/src/renderer/lib/torrent-summary.js @@ -52,5 +52,6 @@ function getByKey (state, torrentKey) { // module. Store root folder explicitly to avoid hacky path processing below. function getFileOrFolder (torrentSummary) { var ts = torrentSummary + if (!ts.path || !ts.files || ts.files.length === 0) return null return path.join(ts.path, ts.files[0].path.split('/')[0]) }