diff --git a/core/backup_context.go b/core/backup_context.go index cb450ec..7c76e95 100644 --- a/core/backup_context.go +++ b/core/backup_context.go @@ -647,13 +647,13 @@ func (b *BackupContext) GetRestore(ctx context.Context, request *backuppb.GetRes } task := b.meta.GetRestoreTask(request.GetId()) - progress := int32(float32(task.GetRestoredSize()) * 100 / float32(task.GetToRestoreSize())) - // don't return zero - if progress == 0 { - progress = 1 - } - task.Progress = progress if task != nil { + progress := int32(float32(task.GetRestoredSize()) * 100 / float32(task.GetToRestoreSize())) + // don't return zero + if progress == 0 { + progress = 1 + } + task.Progress = progress resp.Code = backuppb.ResponseCode_Success resp.Msg = "success" resp.Data = task