diff --git a/lib/model/devicedownloadstate.go b/lib/model/devicedownloadstate.go index e0932bb28..ed9ff7f5f 100644 --- a/lib/model/devicedownloadstate.go +++ b/lib/model/devicedownloadstate.go @@ -140,12 +140,13 @@ func (t *deviceDownloadState) GetBlockCounts(folder string) map[string]int { } t.mut.RLock() + defer t.mut.RUnlock() + for name, state := range t.folders { if name == folder { return state.GetBlockCounts() } } - t.mut.RUnlock() return nil }