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]) }