From 574f97ae4b1d8bc21a98c9beea56ec4e523394df Mon Sep 17 00:00:00 2001 From: Jaime Pillora Date: Sun, 20 Sep 2015 01:06:26 +1000 Subject: [PATCH] fix rare nil deref --- README.md | 2 +- engine/engine.go | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 49ef0527a..07439f6a5 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ $ cloud-torrent --help --version, -v Version: - 0.8.2 + 0.8.3 Read more: https://github.com/jpillora/cloud-torrent diff --git a/engine/engine.go b/engine/engine.go index 25a576e23..2d8a5810b 100644 --- a/engine/engine.go +++ b/engine/engine.go @@ -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() @@ -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 }