Skip to content

Commit 574f97a

Browse files
committed
fix rare nil deref
1 parent 92b2038 commit 574f97a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ $ cloud-torrent --help
5353
--version, -v
5454
5555
Version:
56-
0.8.2
56+
0.8.3
5757
5858
Read more:
5959
https://github.com/jpillora/cloud-torrent

engine/engine.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ func (e *Engine) StartTorrent(infohash string) error {
144144
}
145145
t.Started = true
146146
for _, f := range t.Files {
147-
f.Started = true
147+
if f != nil {
148+
f.Started = true
149+
}
148150
}
149151
if t.t.Info() != nil {
150152
t.t.DownloadAll()
@@ -164,7 +166,9 @@ func (e *Engine) StopTorrent(infohash string) error {
164166
t.t.Drop()
165167
t.Started = false
166168
for _, f := range t.Files {
167-
f.Started = false
169+
if f != nil {
170+
f.Started = false
171+
}
168172
}
169173
return nil
170174
}

0 commit comments

Comments
 (0)