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

NullPointer when filtering list to empty #135

Closed
mmangliers opened this issue Jul 10, 2016 · 1 comment
Closed

NullPointer when filtering list to empty #135

mmangliers opened this issue Jul 10, 2016 · 1 comment

Comments

@mmangliers
Copy link

After entering a filter to my list which removes all views, I hit the following exception:

Attempt to invoke interface method 'void eu.davidea.flexibleadapter.FlexibleAdapter$OnUpdateListener.onUpdateEmptyView(int)' on a null object reference

I believe this is just an issue of operator precedence; we need to add parentheses around the or statement here:

        if (mUpdateListener != null &&
                (initialCount == 0 && getItemCount() > 0) ||
                (initialCount > 0 && getItemCount() == 0))
            mUpdateListener.onUpdateEmptyView(getItemCount());

If the last condition is true, we proceed even if the listener is null. For now I'll sidestep it by providing a listener.

@davideas davideas added the bug label Jul 10, 2016
@davideas
Copy link
Owner

Thanks, yes it looks like operator precedence, missing a parenthesis. However as you already know that part has been completely modified in experiments branch. I will fix for current SNAPSHOT release.

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