Closed Bug 1262600 Opened 4 years ago Closed 4 years ago
crash in java
.lang .Index Out Of Bounds Exception: Invalid index -1, size is 13 at java .util .Array List .throw Index Out Of Bounds Exception(Array List .java)
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
Review commit: https://reviewboard.mozilla.org/r/45141/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/45141/
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.
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.
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+
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.