Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
fix: init may crash with nil state
Browse files Browse the repository at this point in the history
  • Loading branch information
boypt committed Jan 22, 2020
1 parent 2661b99 commit 5077c2e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/server_bg.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ func (s *Server) backgroundRoutines() {

//poll torrents and files
go func() {
// initial state
s.state.Lock()
s.state.Torrents = s.engine.GetTorrents()
s.state.Downloads = s.listFiles()
s.state.Unlock()

for {
if s.state.NumConnections() > 0 {
// only update the state object if user connected
Expand Down

0 comments on commit 5077c2e

Please sign in to comment.