rahulrj / Swipe_RecyclerView

Modifed SwipeList by 47deg to work with RecyclerView
168 stars 38 forks source link

swiping empty recycler causes crash #3

Open ericcumbee opened 9 years ago

ericcumbee commented 9 years ago

Just playing with my app, i noticed that if you swipe an empty swiperecycler it crashes with

java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1 at java.util.ArrayList.get(ArrayList.java:310) at com.fortysevendeg.swipelistview.SwipeListViewTouchListener.closeOtherOpenedItems(SwipeListViewTouchListener.java:997) at com.fortysevendeg.swipelistview.SwipeListViewTouchListener.onTouch(SwipeListViewTouchListener.java:985)

I can post additional code/details tomorrow, but just wanted to put this in before I forgot.

rahulrj commented 9 years ago

I will look into it and update it. Was just too busy, so took time to notice the issue. Thanks.

u2gilles commented 9 years ago

Hi Rahulrj,

It would be great if you could find some time to fix this issue.

In the meanwhile, I added the following quick fix in " in closeOpenedItems() and closeOtherOpenedItems() methods of your lib and recompiled it locally : "if (start==-1) return;"

Also could you please add this lib in a Marven repo and if possible use versions.

Thanks in Advance.

rahulrj commented 9 years ago

Okay. Will do on the coming Thursday as its a holiday.

u2gilles commented 9 years ago

Good. I'm afraid my fix has side effects . Better a clean fix from the designer

Sent from Samsung Mobile.

-------- Original message --------
From: RAHUL RAJA notifications@github.com
Date:13/01/2015 23:51 (GMT+07:00)
To: rahulrj/Swipe_RecyclerView Swipe_RecyclerView@noreply.github.com
Cc: u2gilles u2gilles@gmail.com
Subject: Re: [Swipe_RecyclerView] swiping empty recycler causes crash (#3)
Okay. Will do on the coming Thursday as its a holiday. — Reply to this email directly or view it on GitHub.
bvanhou commented 9 years ago

I am running into the same issue. Attempting to figure out a fix though do not seem to be succeeding.

01-18 23:10:29.329 1264-1264/com.drinkapp.drink E/MessageQueue-JNI﹕ Exception in MessageQueue callback: handleReceiveCallback 01-18 23:10:29.349 1264-1264/com.drinkapp.drink E/MessageQueue-JNI﹕ java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) at java.util.ArrayList.get(ArrayList.java:308) at com.fortysevendeg.swipelistview.SwipeListViewTouchListener.closeOtherOpenedItems(SwipeListViewTouchListener.java:1000) at com.fortysevendeg.swipelistview.SwipeListViewTouchListener.onTouch(SwipeListViewTouchListener.java:986)

u2gilles commented 9 years ago

We may not use the lib in the same way. I recommend you to use a debugger and notice that when start==-1, it crashed. Then add your own fix to make it works until Rahulrj provides the final patch. .