Crash seen on Sentry for Fenix Nightly, has grown in the past two days with hundreds of events.
https://sentry.prod.mozaws.net/operations/fenix-nightly/issues/8870448/?query=is%3Aunresolved
May be related to changes from #9935? or similar to #11906
I think this is caused by the use of engines.list.first() as a fallback value in getDefaultEngine. cc @boek
/**
* Returns first element.
* @throws [NoSuchElementException] if the list is empty.
*/
public fun <T> List<T>.first(): T {
if (isEmpty())
throw NoSuchElementException("List is empty.")
return this[0]
}
I think this is caused by the use of
engines.list.first()as a fallback value ingetDefaultEngine. cc @boek/** * Returns first element. * @throws [NoSuchElementException] if the list is empty. */ public fun <T> List<T>.first(): T { if (isEmpty()) throw NoSuchElementException("List is empty.") return this[0] }
Steps to reproduce
To avoid crash, leave at least one default search engine in list
I made this PR to attempt to address the crash but it certainly doesn't address the cause of the null condition https://github.com/mozilla-mobile/android-components/pull/7531
Can't reproduce on Nightly 200714 06:01. Maybe fixed.
We believe it's been handled by #12544 , please reopen if you see it again after 7/17 Nightly.
Most helpful comment
Steps to reproduce
To avoid crash, leave at least one default search engine in list