Skip to content

Commit

Permalink
fix: calling close on nil output device
Browse files Browse the repository at this point in the history
Closes #33
  • Loading branch information
devgianlu committed May 6, 2024
1 parent 33ee3c0 commit 55f8329
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions player/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,13 @@ loop:
close(p.cmd)

// teardown
if s, ok := source.(io.Closer); ok {
if s, ok := source.(io.Closer); ok && s != nil {
_ = s.Close()
}

_ = out.Close()
if out != nil {
_ = out.Close()
}
}

func (p *Player) HasBeenPlayingFor() time.Duration {
Expand Down

0 comments on commit 55f8329

Please sign in to comment.