Bug 1394024 - Handle null string when alerting plugin about Windows microphone change. r=jimm, a=lizzard
authorDavid Parks <dparks@mozilla.com>
Tue, 12 Sep 2017 14:14:14 -0700
changeset 666733 240330fb1c252763353fca8f0b6672559e32cd31
parent 666732 68f736596f37ea8db749651be22d8a51dca50beb
child 666734 e5b95529a8f804e828de22037d40947f60dd84a9
push id80488
push userbmo:mkelly@mozilla.com
push dateTue, 19 Sep 2017 04:42:30 +0000
reviewersjimm, lizzard
bugs1394024
milestone56.0
Bug 1394024 - Handle null string when alerting plugin about Windows microphone change. r=jimm, a=lizzard Fixes crash when unplugging the only available microphone.
dom/plugins/ipc/PluginUtilsWin.cpp
--- a/dom/plugins/ipc/PluginUtilsWin.cpp
+++ b/dom/plugins/ipc/PluginUtilsWin.cpp
@@ -81,17 +81,17 @@ public:
 
   // IMMNotificationClient Implementation
   HRESULT STDMETHODCALLTYPE
   OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR device_id) override
   {
     NPAudioDeviceChangeDetailsIPC changeDetails;
     changeDetails.flow = (int32_t)flow;
     changeDetails.role = (int32_t)role;
-    changeDetails.defaultDevice = std::wstring(device_id);
+    changeDetails.defaultDevice = device_id ? std::wstring(device_id) : L"";
 
     // Make sure that plugin is notified on the main thread.
     RefPtr<AudioDeviceChangedRunnable> runnable =
       new AudioDeviceChangedRunnable(&mAudioNotificationSet, changeDetails);
     NS_DispatchToMainThread(runnable);
     return S_OK;
   }