Skip to content

Commit

Permalink
chore: remove soundPath on download error
Browse files Browse the repository at this point in the history
  • Loading branch information
jmelahman committed Dec 21, 2024
1 parent 906e9dc commit fd0e882
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ func playSound(dataDir string, sound Sound) (*beep.Ctrl, *os.File, beep.StreamSe
if os.IsNotExist(err) {
err := downloadFileWithProgress(sound.url, soundPath)
if err != nil {
os.Remove(soundPath)
return nil, nil, nil, nil, fmt.Errorf("Error downloading sound: %v", err)
}
file, err = os.Open(soundPath)
Expand Down

0 comments on commit fd0e882

Please sign in to comment.