Bug 1418331 - add null protection. r?drno
MozReview-Commit-ID: 5RnEwdjqdz4
--- a/dom/media/systemservices/VideoEngine.cpp
+++ b/dom/media/systemservices/VideoEngine.cpp
@@ -38,22 +38,25 @@ int VideoEngine::SetAndroidObjects(JavaV
#endif
return 0;
}
#endif
void
VideoEngine::CreateVideoCapture(int32_t& id, const char* deviceUniqueIdUTF8) {
LOG((__PRETTY_FUNCTION__));
+ MOZ_ASSERT(deviceUniqueIdUTF8);
id = GenerateId();
LOG(("CaptureDeviceInfo.type=%s id=%d",mCaptureDevInfo.TypeName(),id));
for (auto &it : mCaps) {
- if (strcmp(it.second.VideoCapture()->CurrentDeviceName(), deviceUniqueIdUTF8) == 0) {
+ if (it.second.VideoCapture() &&
+ it.second.VideoCapture()->CurrentDeviceName() &&
+ strcmp(it.second.VideoCapture()->CurrentDeviceName(), deviceUniqueIdUTF8) == 0) {
mIdMap.emplace(id, it.first);
return;
}
}
CaptureEntry entry = {-1, nullptr};
if (mCaptureDevInfo.type == webrtc::CaptureDeviceType::Camera) {