Commit 13eb6457 authored by Oksana Zhuravlova's avatar Oksana Zhuravlova Committed by Commit Bot

Check the frame for null only if the reader is null

This change moves the frame check inside the reader check to address
cases when GamepadSharedMemoryReader::Start() is called again after
Stop(), but the frame is null. Since the frame parameter is only used
when creating a new instance of GamepadSharedMemoryReader, the check was
moved inside the corresponding condition.

Bug: 864557
Change-Id: I7b32e82f5c79af2007b211cf80cff43ff33be2c9
Reviewed-on: https://chromium-review.googlesource.com/1141156Reviewed-by: default avatarMatt Reynolds <mattreynolds@chromium.org>
Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576095}
parent cc2003bc
......@@ -79,11 +79,12 @@ void GamepadDispatcher::DispatchDidConnectOrDisconnectGamepad(
}
void GamepadDispatcher::StartListening(LocalFrame* frame) {
// TODO(crbug.com/850619): ensure a valid frame is passed
if (!frame)
return;
if (!reader_)
if (!reader_) {
// TODO(crbug.com/850619): ensure a valid frame is passed
if (!frame)
return;
reader_ = std::make_unique<GamepadSharedMemoryReader>(*frame);
}
reader_->Start(this);
}
......
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