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-Original-Commit-Position: refs/heads/master@{#563254}(cherry picked from commit 399b1c2)
Reviewed-on: https://chromium-review.googlesource.com/1082851
Reviewed-by: Ryan Landay <rlanday@chromium.org>
Cr-Commit-Position: refs/branch-heads/3440@{#93}
Cr-Branched-From: 010ddcf-refs/heads/master@{#561733}
  • Loading branch information
rlanday committed Jun 1, 2018
1 parent 0c086c3 commit 6089721
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 6089721

Please sign in to comment.