aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2020-05-21 22:42:28 -0400
committerGitHub <noreply@github.com>2020-05-21 22:42:28 -0400
commitb6434510ce19b472952a03a417c28293d5145398 (patch)
tree0aee2be0ac190ad7d8ff45e3dcdcc04de1e938ee
parent2e6c62ed6214bf7f8d69bad5ef11ccf27f25280a (diff)
downloadservo-jdm-patch-41.tar.gz
servo-jdm-patch-41.zip
Don't try to take log2 of 0 when using mono audio channels.jdm-patch-41
-rw-r--r--components/script/dom/baseaudiocontext.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs
index 42836dd61f0..5904faf623c 100644
--- a/components/script/dom/baseaudiocontext.rs
+++ b/components/script/dom/baseaudiocontext.rs
@@ -487,7 +487,11 @@ impl BaseAudioContextMethods for BaseAudioContext {
let channel = match channels.entry(channel_pos_mask) {
Entry::Occupied(entry) => *entry.get(),
Entry::Vacant(entry) => {
- let x = (channel_pos_mask as f32).log2() as usize;
+ let x = if channel_pos_mask != 0 {
+ (channel_pos_mask as f32).log2() as usize
+ } else {
+ 0
+ };
*entry.insert(x)
},
};