Skip to content

Commit

Permalink
fix: return if buffer is empty while Loading
Browse files Browse the repository at this point in the history
  • Loading branch information
sreeram-narayanan committed Nov 23, 2023
1 parent 6ba80eb commit 966cb87
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ func (l *Loader) Load(src interface{}) (*AudioSegment, error) {
return nil, fmt.Errorf("expected `io.Reader` or file path to original audio")
}

// Empty buffer
if len(buf) == 0 {
return nil, nil
}

// Try to decode it as wave audio
waveAudio, err := wav.DecodeFromBytes(buf)
if err != nil {
Expand Down

0 comments on commit 966cb87

Please sign in to comment.