Skip to content

Commit

Permalink
Merge pull request #1758 from ygalblum/check-report-writer
Browse files Browse the repository at this point in the history
Image copier: make sure ReportWriter is not nil before accessing
  • Loading branch information
openshift-merge-bot[bot] authored Dec 4, 2023
2 parents 630c929 + 0fdbee7 commit d0a7910
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions libimage/copier.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,13 @@ func (c *copier) copy(ctx context.Context, source, destination types.ImageRefere
defer cancel()
defer timer.Stop()

fmt.Fprintf(c.imageCopyOptions.ReportWriter,
"Pulling image %s inside systemd: setting pull timeout to %s\n",
source.StringWithinTransport(),
time.Duration(numExtensions)*extension,
)
if c.imageCopyOptions.ReportWriter != nil {
fmt.Fprintf(c.imageCopyOptions.ReportWriter,
"Pulling image %s inside systemd: setting pull timeout to %s\n",
source.StringWithinTransport(),
time.Duration(numExtensions)*extension,
)
}

// From `man systemd.service(5)`:
//
Expand Down

0 comments on commit d0a7910

Please sign in to comment.