restore: move nil pointer check into restoreui

This commit is contained in:
Michael Eischer 2024-05-31 11:07:53 +02:00
parent 30320a249a
commit 607daeed4f
3 changed files with 18 additions and 30 deletions

View file

@ -59,6 +59,10 @@ func (p *Progress) update(runtime time.Duration, final bool) {
// AddFile starts tracking a new file with the given size
func (p *Progress) AddFile(size uint64) {
if p == nil {
return
}
p.m.Lock()
defer p.m.Unlock()
@ -68,6 +72,10 @@ func (p *Progress) AddFile(size uint64) {
// AddProgress accumulates the number of bytes written for a file
func (p *Progress) AddProgress(name string, bytesWrittenPortion uint64, bytesTotal uint64) {
if p == nil {
return
}
p.m.Lock()
defer p.m.Unlock()