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

Fix: DeckPicker-NullPointerException in onQueryTextChange #17403

Merged
merged 1 commit into from
Nov 29, 2024

Conversation

Giyutomioka-SS
Copy link
Contributor

@Giyutomioka-SS Giyutomioka-SS commented Nov 9, 2024

Purpose / Description

Fixes NullPointerException in onQueryTextChange by safely casting the adapter to Filterable before calling the filter method, preventing crashes when the adapter is null or not of the correct type.

Fixes

How Has This Been Tested?

Realme 6 and Emulator

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@david-allison
Copy link
Member

Did you manage to reproduce the error?

This seems to convert the crash into a bug

@mikehardy mikehardy added the Needs Author Reply Waiting for a reply from the original author label Nov 9, 2024
@Giyutomioka-SS
Copy link
Contributor Author

I couldn’t reproduce the crash. Should I add a null check and logging to catch cases where the adapter or filter is unexpectedly null?

@david-allison
Copy link
Member

We shouldn't rush to a solution

The first step is to understand how the crash occurred, and ideally being able to reproduce it. Once we know this, we'll ideally be able to fix the cause rather than ignore user input

Did you check ACRA for a logcat?

@BrayanDSO BrayanDSO marked this pull request as draft November 19, 2024 13:11
@Giyutomioka-SS Giyutomioka-SS force-pushed the onQueryTextChange branch 3 times, most recently from 8a8c8a7 to 83cac3e Compare November 27, 2024 19:08
@Giyutomioka-SS Giyutomioka-SS marked this pull request as ready for review November 27, 2024 19:23
Copy link
Member

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

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

getting closer to something that might move this one forward, but needs to go to our ACRA server for it to be seen

AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt Outdated Show resolved Hide resolved
Copy link
Member

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

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

That's what I had in mind - doesn't fix the underlying issue but will hopefully get us closer. Thank you

@mikehardy mikehardy added Needs Second Approval Has one approval, one more approval to merge Queued for Cherry Pick to Stable Branch 2.19 and removed Needs Author Reply Waiting for a reply from the original author labels Nov 27, 2024
@mikehardy mikehardy added this to the 2.19.3 release milestone Nov 27, 2024
@mikehardy
Copy link
Member

Going to put this one in as well for 2.19.3, it stops the crash but adds logging and doesn't hide it in acra

@mikehardy mikehardy added this pull request to the merge queue Nov 29, 2024
Merged via the queue into ankidroid:main with commit 34b36c1 Nov 29, 2024
9 checks passed
@github-actions github-actions bot modified the milestones: 2.19.3 release, 2.20 Release Nov 29, 2024
@github-actions github-actions bot removed the Needs Second Approval Has one approval, one more approval to merge label Nov 29, 2024
@mikehardy mikehardy removed this from the 2.20 Release milestone Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DeckPicker: onQueryTextChange - NullPointerException on filter
3 participants