Skip to content

Commit

Permalink
fix: improve error handling in FLAC frame processing
Browse files Browse the repository at this point in the history
- Updated error checking in readFLACBuffered to use errors.Is for better clarity and reliability when handling EOF conditions.
- Enhanced robustness of audio file reading by ensuring consistent error handling practices across the codebase.
  • Loading branch information
tphakala committed Dec 17, 2024
1 parent c19fc41 commit 192710f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/myaudio/readfile_flac.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package myaudio

import (
"encoding/binary"
"errors"
"fmt"
"io"
"os"
Expand Down Expand Up @@ -57,7 +58,7 @@ func readFLACBuffered(file *os.File, settings *conf.Settings, callback AudioChun
// Process FLAC frames
for {
frame, err := decoder.Next()
if err == io.EOF {
if errors.Is(err, io.EOF) {
break
} else if err != nil {
return err
Expand Down

0 comments on commit 192710f

Please sign in to comment.