nikhilpanju / RecyclerViewEnhanced

Android Library to provide swipe, click and other functionality to RecyclerView
1.05k stars 185 forks source link

java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 #18

Open ugurcany opened 8 years ago

ugurcany commented 8 years ago

When the RecyclerView is empty and I click somewhere on empty screen, I'm getting the following exception inside onRowClicked(int position) since callback calls this method although it should not:

09-27 15:16:37.669 24445-24445/cc.chatstop.android E/InputEventReceiver: Exception dispatching input event.
09-27 15:16:37.669 24445-24445/cc.chatstop.android E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
09-27 15:16:37.673 24445-24445/cc.chatstop.android E/MessageQueue-JNI: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
                                                                           at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
                                                                           at java.util.ArrayList.get(ArrayList.java:308)

BTW, I'm using setStackFromEnd(true) for my RecyclerView. Probably, that causes a mistaken callback for an empty list. Please check it.