From e631714a430c13e9517b7a2b9dfd3a58de289c28 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 3 Apr 2016 02:46:18 +0900 Subject: [PATCH] audio: SetVolume now rejects NaN --- exp/audio/audio.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/exp/audio/audio.go b/exp/audio/audio.go index 717052611..7b95d5afc 100644 --- a/exp/audio/audio.go +++ b/exp/audio/audio.go @@ -262,12 +262,9 @@ func (p *Player) Volume() float64 { } func (p *Player) SetVolume(volume float64) { - // TODO: What if volume is NaN? - if 1 < volume { - panic("audio: volume must <= 1") - } - if volume < 0 { - panic("audio: volume must >= 0") + // The condition must be true when volume is NaN. + if !(0 <= volume && volume <= 1) { + panic("audio: volume must be in between 0 and 1") } p.volume = volume }