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

[Bug] FATAL EXCEPTION: notifications is null #214

Closed
golomb1 opened this issue Oct 22, 2016 · 1 comment
Closed

[Bug] FATAL EXCEPTION: notifications is null #214

golomb1 opened this issue Oct 22, 2016 · 1 comment

Comments

@golomb1
Copy link

golomb1 commented Oct 22, 2016

The question is about version 5.0.0-b8.

I tried to fillter the the list using the method:
filterItems(@nonnull List unfilteredItems, @IntRange(from = 0) long delay)
however, after the delay has passed, and the user still editing his text, I got the following exception:

FATAL EXCEPTION: main
java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference
at eu.davidea.flexibleadapter.FlexibleAdapter.executeNotifications(FlexibleAdapter.java:3481)
at eu.davidea.flexibleadapter.FlexibleAdapter.access$2200(FlexibleAdapter.java:94)
at eu.davidea.flexibleadapter.FlexibleAdapter$FilterAsyncTask.onPostExecute(FlexibleAdapter.java:4365)
at eu.davidea.flexibleadapter.FlexibleAdapter$FilterAsyncTask.onPostExecute(FlexibleAdapter.java:4323)
at android.os.AsyncTask.finish(AsyncTask.java:651)
at android.os.AsyncTask.-wrap1(AsyncTask.java)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

I think that the problem is the following line:

notifications = null;

at the end of the method:
private synchronized void executeNotifications();

I believes that changing this line to:
notifications = new ArrayList<>();
will solve the problem.
I would like to hear your opinion.
Thanks.

@davideas
Copy link
Owner

@golomb1, I already fixed this bug, a couple of weeks ago, see issue #191, please use the Snapshot version, which contains also more fixes. Read the bottom of the issue 39 for the changelog.

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

No branches or pull requests

2 participants