Bug 1264991: Don't construct invalid channel configuration. r?gerald
MozReview-Commit-ID: JTZJdCD94gH
--- a/dom/media/MediaInfo.h
+++ b/dom/media/MediaInfo.h
@@ -499,16 +499,20 @@ public:
: mChannelMap(0)
, mValid(false)
{}
explicit ChannelLayout(uint32_t aChannels)
: ChannelLayout(aChannels, SMPTEDefault(aChannels))
{}
ChannelLayout(uint32_t aChannels, const Channel* aConfig)
{
+ if (!aConfig) {
+ mValid = false;
+ return;
+ }
mChannels.AppendElements(aConfig, aChannels);
UpdateChannelMap();
}
bool operator==(const ChannelLayout& aOther) const
{
return mChannels == aOther.mChannels;
}
bool operator!=(const ChannelLayout& aOther) const