Commit 4fd6d94f authored by Mohamed Heikal's avatar Mohamed Heikal Committed by Commit Bot

Prevent crash on back button press if tab model not initialized

WebappActivity inflates its UI asynchronously thus the tab model may not
be initialized during early startup. Calling
ChromeActivity.getCurrentWebContents (happens on back button press),
would crash chrome if the Tab Model is not initialized yet. This cl
fixes the issue and makes ChromeActivity.getCurrentWebContents return
null instead.

Bug: 905583
Change-Id: I4add9cc2f41bb2544e279dd597b7b58a2f68b374
Reviewed-on: https://chromium-review.googlesource.com/c/1340917Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608962}
parent cd62979b
...@@ -1750,6 +1750,9 @@ public abstract class ChromeActivity<C extends ChromeActivityComponent> ...@@ -1750,6 +1750,9 @@ public abstract class ChromeActivity<C extends ChromeActivityComponent>
* WebContents. * WebContents.
*/ */
public WebContents getCurrentWebContents() { public WebContents getCurrentWebContents() {
if (!mTabModelsInitialized) {
return null;
}
return TabModelUtils.getCurrentWebContents(getCurrentTabModel()); return TabModelUtils.getCurrentWebContents(getCurrentTabModel());
} }
......
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