Skip to content

Commit

Permalink
Ensure an invalid jpeg is closed before removal is attempted, to fix …
Browse files Browse the repository at this point in the history
…crash on Windows
  • Loading branch information
nickjwhite committed Mar 4, 2024
1 parent 409a17b commit 24cd1e7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions cmd/rescribe/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ func rmIfNotImage(f string) error {
return fmt.Errorf("Failed to open image %s: %v\n", f, err)
}
_, err = jpeg.Decode(r)
r.Close()
if err == nil {
return nil
}
Expand Down

0 comments on commit 24cd1e7

Please sign in to comment.