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
This commit is contained in:
@@ -263,7 +263,7 @@ function deleteFile (path) {
|
|||||||
// Delete all files in a torrent
|
// Delete all files in a torrent
|
||||||
function moveItemToTrash (torrentSummary) {
|
function moveItemToTrash (torrentSummary) {
|
||||||
var filePath = TorrentSummary.getFileOrFolder(torrentSummary)
|
var filePath = TorrentSummary.getFileOrFolder(torrentSummary)
|
||||||
ipcRenderer.send('moveItemToTrash', filePath)
|
if (filePath) ipcRenderer.send('moveItemToTrash', filePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
function showItemInFolder (torrentSummary) {
|
function showItemInFolder (torrentSummary) {
|
||||||
|
|||||||
@@ -52,5 +52,6 @@ function getByKey (state, torrentKey) {
|
|||||||
// module. Store root folder explicitly to avoid hacky path processing below.
|
// module. Store root folder explicitly to avoid hacky path processing below.
|
||||||
function getFileOrFolder (torrentSummary) {
|
function getFileOrFolder (torrentSummary) {
|
||||||
var ts = 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])
|
return path.join(ts.path, ts.files[0].path.split('/')[0])
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user