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

applyAndAnimateRemovals has still NullPointerException #745

Open
laurimaki opened this issue Sep 12, 2019 · 1 comment
Open

applyAndAnimateRemovals has still NullPointerException #745

laurimaki opened this issue Sep 12, 2019 · 1 comment

Comments

@laurimaki
Copy link

Hi @davideas! Seems like this NPE issue is still not addressed after the c2be014. Its still throwing NPE's. Now at the line 4470 of FlexibleAdapter.applyAndAnimateRemovals().

For the background: I cloned this repository master branch with the commit having hash identifier 10933e8, and built the library as .aar, and included that to our project. This NPE crash at FlexibleAdapter.applyAndAnimateRemovals is top 1 crash for our app. I wished that c2be014 would have fixed this issue, but it didn't. It still happens randomly to users. There doesn't seem to be any connecting pattern based on device model or brand or Android OS version.

Here is stack trace from the crash reporting for the NPE crash:

Fatal Exception: java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$3.done + 318(AsyncTask.java:318) at java.util.concurrent.FutureTask.finishCompletion + 354(FutureTask.java:354) at java.util.concurrent.FutureTask.setException + 223(FutureTask.java:223) at java.util.concurrent.FutureTask.run + 242(FutureTask.java:242) at java.util.concurrent.ThreadPoolExecutor.runWorker + 1133(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run + 607(ThreadPoolExecutor.java:607) at java.lang.Thread.run + 762(Thread.java:762)

Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference at eu.davidea.flexibleadapter.FlexibleAdapter.applyAndAnimateRemovals + 4470(FlexibleAdapter.java:4470) at eu.davidea.flexibleadapter.FlexibleAdapter.animateTo + 4404(FlexibleAdapter.java:4404) at eu.davidea.flexibleadapter.FlexibleAdapter.animateDiff + 4380(FlexibleAdapter.java:4380) at eu.davidea.flexibleadapter.FlexibleAdapter.access$1900 + 90(FlexibleAdapter.java:90) at eu.davidea.flexibleadapter.FlexibleAdapter$FilterAsyncTask.doInBackground + 5625(FlexibleAdapter.java:5625) at eu.davidea.flexibleadapter.FlexibleAdapter$FilterAsyncTask.doInBackground + 5584(FlexibleAdapter.java:5584) at android.os.AsyncTask$2.call + 304(AsyncTask.java:304) at java.util.concurrent.FutureTask.run + 237(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker + 1133(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run + 607(ThreadPoolExecutor.java:607) at java.lang.Thread.run + 762(Thread.java:762)

@laurimaki
Copy link
Author

I found a workaround to this crash. With FlexibleAdapter.setAnimateChangesWithDiffUtil(true) crash doesn't happen anymore. Using framework DiffUtils instead of library's own custom build "diff util", avoids the code path in FlexibleAdapter.applyAndAnimateRemovals() with the bug causing NPE crashes.

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

No branches or pull requests

1 participant