Skip to content

Commit d85d450

Browse files
committed
oto: bug fix: wrap an error only when err is not nil
1 parent 0d8cdba commit d85d450

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

player.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ func (p *Player) BufferedSize() int {
6565

6666
// Err returns an error if this player has an error.
6767
func (p *Player) Err() error {
68-
return fmt.Errorf("oto: audio error: %w", p.player.Err())
68+
if err := p.player.Err(); err != nil {
69+
return fmt.Errorf("oto: audio error: %w", err)
70+
}
71+
return nil
6972
}
7073

7174
// SetBufferSize sets the buffer size.

0 commit comments

Comments
 (0)