Commit 43ffe612 authored by Suman Nelson Kancherla's avatar Suman Nelson Kancherla Committed by Commit Bot

Fixed crash by null-deref of XR::service_

This can happen when a VRService couldn't be started on browser process,
which calls an error handler callback that releases the service_ pointer.

Fixed it by adding a nullptr check around the usage of service_.

Also, checked if there are any other similar references.

Bug: 961971
Change-Id: Icda57d91280e46df07b88db858a0539b7fac1526
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1610467
Commit-Queue: Suman Kancherla <sumankancherla@chromium.org>
Reviewed-by: default avatarKlaus Weidner <klausw@chromium.org>
Reviewed-by: default avatarBill Orr <billorr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659216}
parent b7a75876
...@@ -477,6 +477,9 @@ void XR::AddedEventListener(const AtomicString& event_type, ...@@ -477,6 +477,9 @@ void XR::AddedEventListener(const AtomicString& event_type,
EventTargetWithInlineData::AddedEventListener(event_type, EventTargetWithInlineData::AddedEventListener(event_type,
registered_listener); registered_listener);
if (!service_)
return;
if (event_type == event_type_names::kDevicechange) { if (event_type == event_type_names::kDevicechange) {
// Register for notifications if we haven't already. // Register for notifications if we haven't already.
// //
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment