Skip to content

Commit

Permalink
Fix null pointer exception in NonOverlappingStack#getNonDyingTabCount()
Browse files Browse the repository at this point in the history
Stack#mStackTabs is sometimes null, so we need to do a null pointer check in
NonOverlappingStack#getNonDyingTabCount() to avoid a crash. In particular, the
following sequence of steps currently causes a crash:

- Close all normal tabs and open an incognito tab
- Focus the incognito tab
- Tap the tab switcher button on the toolbar

This CL fixes this crash.

Bug: 831359,846266
Change-Id: I0a64e0134458af772f944d650daf57a0c0650d68
Reviewed-on: https://chromium-review.googlesource.com/1074219
Reviewed-by: Matthew Jones <mdjones@chromium.org>
Commit-Queue: Ryan Landay <rlanday@chromium.org>
Cr-Commit-Position: refs/heads/master@{#563254}
  • Loading branch information
rlanday authored and Commit Bot committed May 31, 2018
1 parent 1685e3c commit 399b1c2
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public NonOverlappingStack(Context context, StackLayoutBase layout) {
}

private int getNonDyingTabCount() {
if (mStackTabs == null) return 0;

int dyingCount = 0;
for (int i = 0; i < mStackTabs.length; i++) {
if (mStackTabs[i].isDying()) dyingCount++;
Expand Down

0 comments on commit 399b1c2

Please sign in to comment.