Fixed undefined error when downloading BitTorrent Magnet links.

This commit is contained in:
Carl Monnig 2013-01-04 23:23:46 +02:00
parent 36f280ada0
commit c287960fa8

View File

@ -365,7 +365,7 @@ function getTemplateCtx(data) {
var name; var name;
var seed = (data.files[0].path || data.files[0].uris[0].uri).split(/[/\\]/); var seed = (data.files[0].path || data.files[0].uris[0].uri).split(/[/\\]/);
name = seed[seed.length - 1]; name = seed[seed.length - 1];
if (data.bittorrent) { if (data.bittorrent && data.bittorrent.info) {
name = data.bittorrent.info.name; name = data.bittorrent.info.name;
} }
var chunks = percentage !== 100 && data.bitfield ? getChunksFromHex(data.bitfield, data.numPieces) : []; var chunks = percentage !== 100 && data.bitfield ? getChunksFromHex(data.bitfield, data.numPieces) : [];