mirror of
https://github.com/restic/restic.git
synced 2025-04-28 12:00:49 +00:00
Skip unlocking for nil locks
Now that lockRepo receives a context, it is possible that it is canceled before a lock was created. Thus `unlockRepo` must be able to handle this case.
This commit is contained in:
parent
0c9efa9c2a
commit
2964d2ad15
@ -86,6 +86,10 @@ func refreshLocks(wg *sync.WaitGroup, done <-chan struct{}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func unlockRepo(lock *restic.Lock) error {
|
func unlockRepo(lock *restic.Lock) error {
|
||||||
|
if lock == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
globalLocks.Lock()
|
globalLocks.Lock()
|
||||||
defer globalLocks.Unlock()
|
defer globalLocks.Unlock()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user