Skip to content

Commit

Permalink
Fix nil pointer panic on error
Browse files Browse the repository at this point in the history
  • Loading branch information
fasmat committed Sep 19, 2023
1 parent 27c3dd7 commit 2cba9d0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions activation/nipost_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ const (
)

func write(path string, data []byte) error {
tmp, err := os.Create(fmt.Sprintf("%s.tmp", path))
tmpName := fmt.Sprintf("%s.tmp", path)
tmp, err := os.Create(tmpName)
if err != nil {
return fmt.Errorf("create temporary file %s: %w", tmp.Name(), err)
return fmt.Errorf("create temporary file %s: %w", tmpName, err)

Check warning on line 28 in activation/nipost_state.go

View check run for this annotation

Codecov / codecov/patch

activation/nipost_state.go#L28

Added line #L28 was not covered by tests
}

checksum := crc64.New(crc64.MakeTable(crc64.ISO))
Expand Down

0 comments on commit 2cba9d0

Please sign in to comment.