Skip to content

Commit

Permalink
[sidepanelpinning] fix potential crash for trying to hide an action t…
Browse files Browse the repository at this point in the history
…hat doesn't exist.

I found this while fixing the SidePanelCoordinatorTests, which I'll send
out after this. If for some reason this gets called twice for a popped
out button, the button will first be removed then the second time a
button cannot be found which would cause a crash.

Bug: 1509504
Change-Id: I395a9ebfaeb96995d1e968e6b1062eeaec252f98
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5099962
Reviewed-by: Darryl James <dljames@chromium.org>
Commit-Queue: Caroline Rising <corising@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1234632}
  • Loading branch information
Caroline Rising authored and Chromium LUCI CQ committed Dec 7, 2023
1 parent 5b03e1c commit 7c1f821
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,12 @@ void PinnedToolbarActionsContainer::UpdateActionState(actions::ActionId id,
button = AddPopOutButtonFor(id);
}
}
// If the button doesn't exist, do nothing. This could happen if |is_active|
// is false and there is no existing pinned out popped out button for the
// |id|.
if (!button) {
return;
}

// Update button highlight and force visibility if the button is active.
if (is_active) {
Expand Down

0 comments on commit 7c1f821

Please sign in to comment.