Commit c4c26f39 authored by Robbie Gibson's avatar Robbie Gibson Committed by Commit Bot

[iOS] Fix crash when closing last tab with FindInPage active

The reason for the crash is that when the last tab is closed, there
is no more current web state, so it's impossible to get a FindTabHelper.

Bug: 1044606
Change-Id: I1f47ca7751c0f808e6d53abd4cb8356dd68de126
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2023831Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Cr-Commit-Position: refs/heads/master@{#735844}
parent 496b07ef
...@@ -66,10 +66,16 @@ ...@@ -66,10 +66,16 @@
if (!self.presenter.isPresenting) { if (!self.presenter.isPresenting) {
return; return;
} }
FindTabHelper* helper = FindTabHelper::FromWebState(self.currentWebState);
// If the FindUI is still active, the dismiss should be unanimated, because // If the FindUI is still active, the dismiss should be unanimated, because
// the UI will be brought back later. // the UI will be brought back later.
BOOL animated = helper && !helper->IsFindUIActive(); BOOL animated;
if (self.currentWebState) {
FindTabHelper* helper = FindTabHelper::FromWebState(self.currentWebState);
animated = helper && !helper->IsFindUIActive();
} else {
animated = true;
}
[self.findBarController findBarViewWillHide]; [self.findBarController findBarViewWillHide];
[self.presenter dismissAnimated:animated]; [self.presenter dismissAnimated:animated];
} }
......
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