Skip to content

Commit

Permalink
fix rare nil deref
Browse files Browse the repository at this point in the history
  • Loading branch information
jpillora committed Sep 19, 2015
1 parent 92b2038 commit 574f97a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ $ cloud-torrent --help
--version, -v
Version:
0.8.2
0.8.3
Read more:
https://github.com/jpillora/cloud-torrent
Expand Down
8 changes: 6 additions & 2 deletions engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ func (e *Engine) StartTorrent(infohash string) error {
}
t.Started = true
for _, f := range t.Files {
f.Started = true
if f != nil {
f.Started = true
}
}
if t.t.Info() != nil {
t.t.DownloadAll()
Expand All @@ -164,7 +166,9 @@ func (e *Engine) StopTorrent(infohash string) error {
t.t.Drop()
t.Started = false
for _, f := range t.Files {
f.Started = false
if f != nil {
f.Started = false
}
}
return nil
}
Expand Down

0 comments on commit 574f97a

Please sign in to comment.