fix(download): crash on download page click in some cases #34

This commit is contained in:
Alexey Kasyanchuk 2018-06-19 00:20:52 +03:00
parent 9adebf8d4d
commit 44efa6138e
3 changed files with 6 additions and 2 deletions

View File

@ -43,7 +43,7 @@ export default class TopPage extends Page {
<RaisedButton label={__('Back to main page')} primary={true} onClick={() => {
window.router('/')
}} />
<List style={{paddingBottom: '70px'}} className='animated recent-torrents'>
<List style={{paddingBottom: '70px', minWidth: '60%'}} className='animated recent-torrents'>
{
this.downloads.map((download, index) => {
return <TorrentLine key={index} torrent={download.torrentObject} download={download} />

View File

@ -218,7 +218,10 @@ export default class Torrent extends Component {
}
render()
{
const torrent = this.props.torrent;
const torrent = this.props.torrent;
if(!torrent)
return null // can try draw null torrent (for example on downloading not started)
let torrentRating = -1
if(torrent.good > 0 || torrent.bad > 0)
torrentRating = Math.round(rating(torrent.good, torrent.bad) * 100);

View File

@ -626,6 +626,7 @@ module.exports = async ({
torrentClient.remove(id, (err) => {
if(err)
{
console.log('download removing error', err)
if(callback)
callback(false)
return