codepath-android-fall16-group-8 / travel

3 stars 3 forks source link

Bug: invalid media launcher item index #22

Closed heyhuyen closed 7 years ago

heyhuyen commented 7 years ago

Steps to reproduce: 1) Take some photos with the camera app. 2) Have a trip/story with at least two places. 2) Go to the story collage view. 3) Swipe to delete the first place. 4) Tap on the gallery icon to add a photo to second place. 5) Select photo from gallery. 6) App crashes with index out of bounds error:

                  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.codepath.travel.activities.StoryActivity.lambda$compressAndSaveImage$3(StoryActivity.java:170)

StoryActivity.java, line 17

            media.setStoryPlace(mStoryPlaces.get(mMediaLauncherStoryIndex));

When we delete an item, we need to delete it from Parse.