fix: crash when failed to get devices in desktopCapturer (#17973)

* fix: crash when failed to get devices in desktopCapturer

* return after emit
This commit is contained in:
trop[bot]
2019-04-26 08:05:12 -07:00
committed by Shelley Vohr
parent d92743f0f3
commit 7226ad1eba
2 changed files with 14 additions and 3 deletions

View File

@@ -165,8 +165,12 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
std::vector<std::string> device_names;
// Crucially, this list of device names will be in the same order as
// |media_list_sources|.
webrtc::DxgiDuplicatorController::Instance()->GetDeviceNames(
&device_names);
if (!webrtc::DxgiDuplicatorController::Instance()->GetDeviceNames(
&device_names)) {
Emit("error", "Failed to get sources.");
return;
}
int device_name_index = 0;
for (auto& source : screen_sources) {
const auto& device_name = device_names[device_name_index++];