Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Commit

Permalink
For #8054 - Focus should not crash when search engines are restored. (#…
Browse files Browse the repository at this point in the history
…8059)

(cherry picked from commit 63ba241)

Co-authored-by: iorgamgabriel <iorgamgabriel@yahoo.com>
  • Loading branch information
mergify[bot] and iorgamgabriel committed Nov 21, 2022
1 parent 75cba87 commit e4d102f
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ class RadioSearchEngineListPreference : SearchEngineListPreference, RadioGroup.O
}

override fun onCheckedChanged(group: RadioGroup, checkedId: Int) {
val selectedEngine = group.getChildAt(checkedId)
val selectedEngine = group.getChildAt(checkedId) ?: return

// check if the corresponding button was pressed or a11y focused.
val hasProperState = selectedEngine.isPressed || selectedEngine.isAccessibilityFocused

/* onCheckedChanged is called intermittently before the search engine table is full, so we
must check these conditions to prevent crashes and inconsistent states. */
if (group.childCount != searchEngines.count() || selectedEngine == null || !hasProperState) {
if (group.childCount != searchEngines.count() || !hasProperState) {
return
}

Expand Down

0 comments on commit e4d102f

Please sign in to comment.