UserMediaController::from(document) can return nullptr
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Nov 2019 22:53:47 +0000 (22:53 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Nov 2019 22:53:47 +0000 (22:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=203977
<rdar://problem/56908013>

Reviewed by Jer Noble.

* Modules/mediastream/MediaDevices.cpp:
(WebCore::MediaDevices::stop): NULL-check the UserMediaController.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252207 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/MediaDevices.cpp

index d508c26..f95b538 100644 (file)
@@ -1,3 +1,14 @@
+2019-11-07  Eric Carlson  <eric.carlson@apple.com>
+
+        UserMediaController::from(document) can return nullptr
+        https://bugs.webkit.org/show_bug.cgi?id=203977
+        <rdar://problem/56908013>
+
+        Reviewed by Jer Noble.
+
+        * Modules/mediastream/MediaDevices.cpp:
+        (WebCore::MediaDevices::stop): NULL-check the UserMediaController.
+
 2019-11-07  Chris Dumez  <cdumez@apple.com>
 
         Port ServiceWorkerContainer to the HTML5 event loop
index d85ed0c..ea2d5ce 100644 (file)
@@ -75,7 +75,8 @@ void MediaDevices::stop()
 {
     if (m_deviceChangeToken) {
         auto* controller = UserMediaController::from(document()->page());
-        controller->removeDeviceChangeObserver(m_deviceChangeToken);
+        if (controller)
+            controller->removeDeviceChangeObserver(m_deviceChangeToken);
     }
     m_devices.clear();
     m_scheduledEventTimer.stop();