Skip to content

fix(filtered-deck): preserve error message for InvalidSearchException…#21374

Merged
lukstbit merged 1 commit into
ankidroid:mainfrom
SajalDevX:fix/invalid-search-filtered-deck-crash-21338
Jul 17, 2026
Merged

fix(filtered-deck): preserve error message for InvalidSearchException…#21374
lukstbit merged 1 commit into
ankidroid:mainfrom
SajalDevX:fix/invalid-search-filtered-deck-crash-21338

Conversation

@SajalDevX

@SajalDevX SajalDevX commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Purpose / Description

Crash when trying to preview an invalid search in the filtered deck options. when a user enters an invalid search query
(eg->"is:nee") and taps the search icon, the app crashes with "IllegalArgumentException either 'stringRes' or 'text' must be set".

Fixes

Approach

The root cause is that "FilteredDeckOptionsViewModel.onSearchBrowser()" creates and exception without preserving the message from the original "BackendSearchException". The message property was null, which caused the error dialog to crash when trying to display it.

How Has This Been Tested?

Tested the fixes on Pixel 8a(emulator android 17) and VivoV27(android 15), added regression test and also ran unit test FilteredDeckOptionsViewModelTest to ensure existing functionality is preserved.

Learning (optional, can help others)

NA

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

… in filtered deck

the crash occurred when invalid search query was used and the search icon was tapped. here the InvalidSearchException was created without a message, causing the error dialog to crash.
the fix ensures the localizedMessage is preserved
@welcome

welcome Bot commented Jul 16, 2026

Copy link
Copy Markdown

First PR! 🚀 We sincerely appreciate that you have taken the time to propose a change to AnkiDroid! Please have patience with us as we are all volunteers - we will get to this as soon as possible.

@lukstbit lukstbit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, thanks for contributing!

@lukstbit lukstbit added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Jul 16, 2026
@criticalAY
criticalAY added this pull request to the merge queue Jul 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 16, 2026
@SajalDevX

Copy link
Copy Markdown
Contributor Author

@lukstbit @criticalAY Thanks for reviewing and approving the PR.
This pr was removed from the merge-queue bcz of some resource constraints in the macos. Could you guys please guide me what to do next to fix this?

@lukstbit
lukstbit added this pull request to the merge queue Jul 17, 2026
Merged via the queue into ankidroid:main with commit 71a5c0f Jul 17, 2026
20 checks passed
@github-actions github-actions Bot added this to the 2.25 release milestone Jul 17, 2026
@github-actions github-actions Bot removed the Needs Second Approval Has one approval, one more approval to merge label Jul 17, 2026
@lukstbit

Copy link
Copy Markdown
Member

Could you guys please guide me what to do next to fix this?

You don't have to do anything, sometimes there are issues when merging PRs and we'll manually intervene. I added it again and it's merged now, thanks.

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.

Crash when trying to preview an invalid search in the filtered deck options

3 participants