Closed Bug 1262600 Opened 4 years ago Closed 4 years ago

crash in java.lang.IndexOutOfBoundsException: Invalid index -1, size is 13 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java)

Categories

(Firefox for Android :: General, defect, critical)

48 Branch
ARM
Android
defect
Not set
critical

Tracking

()

RESOLVED FIXED
Firefox 48
Tracking Status
firefox48 --- verified
fennec 48+ ---

People

(Reporter: TeoVermesan, Assigned: liuche)

References

(Blocks 1 open bug)

Details

(Keywords: crash)

Crash Data

Attachments

(1 file)

This bug was filed from the Socorro interface and is 
report bp-297d9256-a905-41df-ade3-ee3762160406.
=============================================================
Steps to reproduce:
1. Perform sync
2. Go to the History panel
3. Hide 2 or 3 devices
4. Unhide them

Actual results:
- Firefox crashes

Expected results:
- Hidden devices should be displayed
Assignee: nobody → liuche
Blocks: home-panels
tracking-fennec: --- → ?
tracking-fennec: ? → 48+
Blocks: combined-history
No longer blocks: home-panels
To clarify: I reverted the change I made to create getHiddenItemsIndex because the hidden item is not always present and depends on state around "were items been removed" or "are there any hidden items left" so I think it's better to handle that locally, rather than have a method.
Attachment #8739237 - Flags: review?(s.kaspari)
Comment on attachment 8739237 [details]
MozReview Request: Bug 1262600 - crash in java.lang.IndexOutOfBoundsException: Invalid index -1, size is 13 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java). r=sebastian

https://reviewboard.mozilla.org/r/45141/#review41681

I don't understand the difference: This should still use an index of -1 if the list is empty or am I missing something?
Actually we should never be returning -1 because the value is used as a list index, so I just removed the method. The method returned -1 if hiddenClients was empty, which I realized is exactly the wrong assumption because we're calling it in the case where the UI is *not* consistent with the state of hiddenClients because we want to update it to be consistent!

Basically, we're finding the index of the (no longer needed) "N devices hidden" list item so we can call notifyItemRemoved. It's not really possible to tell whether the "N devices hidden" list item is actually present based on the state of data structures, so it's better to leave the logic in place because then it's more clear that when we're using the "size() - 1" call, the size is never 0.
Attachment #8739237 - Flags: review?(s.kaspari)
Comment on attachment 8739237 [details]
MozReview Request: Bug 1262600 - crash in java.lang.IndexOutOfBoundsException: Invalid index -1, size is 13 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java). r=sebastian

https://reviewboard.mozilla.org/r/45141/#review41873

Ah, now I get it. I didn't see that the method was using hiddenClients and your new code is using remoteClients.
Attachment #8739237 - Flags: review?(s.kaspari) → review+
https://hg.mozilla.org/mozilla-central/rev/922682fb9d2a
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 48
Verified as fixed on the 48.0b1 build. This issue was tested on a Nexus 6P (Android 7.0), ZTE Grand X (Android 4.0.4) and on a Sony Xperia Z2 (Android 5.0.2)
You need to log in before you can comment on or make changes to this bug.