0

While developing Android, I wrote Adapter code for RecyclerView. But intermittently, the app closes abnormally. As a result of checking through Crashlytics of Firebase, the error contents were as follows.

enter image description here

It's an intermittent bug, so I don't know how to fix it.

1 Answer 1

2

You are using the kotlin extension function first, the crash report is quite clear about what's gone wrong "Collection contains no element matching the predicate". This means that the condition you check for in first.{check on of the items in the list meets this condition} is returning no values.

How you handle this error is up to you. I would personally replace first with firstOrNull and do something appropriate if null is encountered

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.