mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-02-20 20:29:02 +00:00
don't crash if torrent.announce is undefined
This commit is contained in:
parent
8ba742eed4
commit
48dcab8420
@ -49,11 +49,8 @@ function Client (peerId, port, torrent, opts) {
|
||||
|
||||
debug('new client %s', self._infoHash.toString('hex'))
|
||||
|
||||
if (typeof torrent.announce === 'string') {
|
||||
// magnet-uri returns a string if the magnet uri only contains one 'tr' parameter
|
||||
torrent.announce = [ torrent.announce ]
|
||||
}
|
||||
self._trackers = torrent.announce
|
||||
if (typeof torrent.announce === 'string') torrent.announce = [ torrent.announce ]
|
||||
self._trackers = (torrent.announce || [])
|
||||
.filter(function (announceUrl) {
|
||||
return announceUrl.indexOf('udp://') === 0 || announceUrl.indexOf('http://') === 0
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user