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

DeckPicker: onQueryTextChange - NullPointerException on filter #17391

Closed
Tracked by #17370
david-allison opened this issue Nov 7, 2024 · 3 comments · Fixed by #17403
Closed
Tracked by #17370

DeckPicker: onQueryTextChange - NullPointerException on filter #17391

david-allison opened this issue Nov 7, 2024 · 3 comments · Fixed by #17403
Labels

Comments

@david-allison
Copy link
Member

david-allison commented Nov 7, 2024

https://ankidroid.org/acra/app/1/bug/253121/report/f6ecbbf9-859d-40bb-b281-acbd2572d01a

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Filter.filter(java.lang.CharSequence)' on a null object reference
	at com.ichi2.anki.DeckPicker$setupSearchIcon$2$1.onQueryTextChange(DeckPicker.java:932)
	at androidx.appcompat.widget.SearchView.onTextChanged(SearchView.java:1198)
	at androidx.appcompat.widget.SearchView$10.onTextChanged(SearchView.java:1736)
	at android.widget.TextView.sendOnTextChanged(TextView.java:13051)
	at android.widget.TextView.setText(TextView.java:7784)
	at android.widget.TextView.setText(TextView.java:7596)
	at android.widget.EditText.setText(EditText.java:233)
	at android.widget.TextView.setText(TextView.java:7533)
	at androidx.appcompat.widget.SearchView.onActionViewExpanded(SearchView.java:1312)
	at androidx.appcompat.widget.Toolbar$ExpandedActionViewMenuPresenter.expandItemActionView(Toolbar.java:2748)
	at androidx.appcompat.view.menu.MenuBuilder.expandItemActionView(MenuBuilder.java:1363)
	at androidx.appcompat.view.menu.MenuItemImpl.expandActionView(MenuItemImpl.java:828)
	at androidx.appcompat.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:989)
	at androidx.appcompat.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:974)
	at androidx.appcompat.widget.ActionMenuView.invokeItem(ActionMenuView.java:620)
	at androidx.appcompat.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:155)
	at android.view.View.performClick(View.java:8037)
	at android.view.View.performClickInternal(View.java:8006)
	at android.view.View.-$$Nest$mperformClickInternal(Unknown Source)
	at android.view.View$PerformClick.run(View.java:32003)
	at android.os.Handler.handleCallback(Handler.java:996)
	at android.os.Handler.dispatchMessage(Handler.java:110)
	at android.os.Looper.loopOnce(Looper.java:210)
	at android.os.Looper.loop(Looper.java:302)
	at android.app.ActivityThread.main(ActivityThread.java:9652)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:601)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1062)

@david-allison david-allison changed the title https://ankidroid.org/acra/app/1/bug/253121/report/f6ecbbf9-859d-40bb-b281-acbd2572d01a DeckPicker: onQueryTextChange - NullPointerException on filter Nov 7, 2024
@david-allison david-allison added this to the 2.19.2 release milestone Nov 7, 2024
@Giyutomioka-SS
Copy link
Contributor

looking into this!

@david-allison
Copy link
Member Author

To follow on from the PR:

This crash report didn't have a stack trace. Finding a matching one which does would be a great first step

From then it should be easier to understand or reproduce

@mikehardy
Copy link
Member

Reproduction of the logic:

  • you need a large device to switch in to our fragmented layout on DeckPicker
  • you need enough decks in your deck list that the search icon shows up
  • you click search and start typing: that is the thing that triggers onQueryTextChange

However, the only time I could see the adapter being null is if DeckPicker::onCreate wasn't called, because if it is called and did not throw an exception or other catastrophic error it will set the recyclerView.adapter to our DeckAdapter in onCreate

And I don't see where else that could be set to null, such that the adapter wouldn't be there when we asked it to filter

All I can think to do here is to guard against null (WHY ARE WE USING !! THERE !?) and sendExceptionReport for triage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants