Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent possible crash when showing results for other languages #4958

Merged
merged 20 commits into from
Nov 5, 2024

Conversation

cooltey
Copy link
Collaborator

@cooltey cooltey commented Sep 13, 2024

What does this do?

Fix a possible crash when showing results for other languages in the SearchResultsFragment

Why is this needed?

We get the language code by providing a position to the language list, which may cause a crash.

val langCode = WikipediaApp.instance.languageState.appLanguageCodes[position]

This PR changes the plain list to a Pair<> that contains the language code with its result counts.

The error log in console

https://play.google.com/console/u/1/developers/6169333749249604352/app/4976363884102945010/vitals/crashes/0e0fb84f88cb64408c0412acfb8550ff/details?days=28&versionCode=50501&isUserPerceived=true

@cooltey cooltey requested a review from dbrant as a code owner September 13, 2024 19:38
@cooltey cooltey changed the title Fix crash no results Prevent possible crash when showing results for other languages Sep 13, 2024
@cooltey cooltey added the Minor Minor stuff label Sep 20, 2024
Copy link
Member

@dbrant dbrant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good refactor. (The six affected users will thank us!)

@cooltey cooltey requested a review from dbrant September 26, 2024 16:39
@cooltey cooltey requested a review from Williamrai as a code owner October 7, 2024 16:11
@dbrant dbrant merged commit 430148f into main Nov 5, 2024
1 check passed
@dbrant dbrant deleted the fix-crash-no-results branch November 5, 2024 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Minor Minor stuff
Development

Successfully merging this pull request may close these issues.

2 participants