Commit 0b58a4c9 authored by Mario Sanchez Prada's avatar Mario Sanchez Prada Committed by Commit Bot

Add missing null-check for UnhandledTapWebContentsObserver from WebContents

We need to check what UnhandledTapWebContentsObserver::FromWebContents()
returns before using it to make sure it's not null before trying to bind
the receiver, otherwise it will crash.

See crrev.com/c/1887615 for extra context in the original CL.

Bug: 936482,1006361,1021827
Change-Id: I52113a994722df552cbdf85c98efaed685dacd2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1900004
Commit-Queue: Mario Sanchez Prada <mario@igalia.com>
Reviewed-by: default avatarDonn Denman <donnd@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713502}
parent f7fb2886
...@@ -65,10 +65,13 @@ void BindUnhandledTapWebContentsObserver( ...@@ -65,10 +65,13 @@ void BindUnhandledTapWebContentsObserver(
auto* unhandled_tap_notifier_observer = auto* unhandled_tap_notifier_observer =
contextual_search::UnhandledTapWebContentsObserver::FromWebContents( contextual_search::UnhandledTapWebContentsObserver::FromWebContents(
content::WebContents::FromRenderFrameHost(host)); content::WebContents::FromRenderFrameHost(host));
contextual_search::CreateUnhandledTapNotifierImpl(
unhandled_tap_notifier_observer->device_scale_factor(), if (unhandled_tap_notifier_observer) {
unhandled_tap_notifier_observer->unhandled_tap_callback(), contextual_search::CreateUnhandledTapNotifierImpl(
std::move(receiver)); unhandled_tap_notifier_observer->device_scale_factor(),
unhandled_tap_notifier_observer->unhandled_tap_callback(),
std::move(receiver));
}
} }
#endif // BUILDFLAG(ENABLE_UNHANDLED_TAP) #endif // BUILDFLAG(ENABLE_UNHANDLED_TAP)
......
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