If the groups mutable array is emptied at some point before cellForRowAt... #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
...IndexPath is called, this can cause a crash.
Intermittently I've come across a crash when taking photos with the camera using this library, and Crashlytics reports this as being an
NSRange Exception: Index 0 beyond bounds for empty array
as seen below. I've found this a tough nut to crack in terms of reproducibility, but I can say that it only seems to happen when taking a photo. Also, this was mentioned in a side-comment on #20.This was quite puzzling to me as normally
cellForRowAtIndexPath:
isn't called when the data source array is empty, so I figured there was some issue where perhaps thegroups
property on theUzysGroupPickerView
was altered without updating the tableview.In going through the code briefly in an attempt to track down the issue, my understanding is that the
UzysAssetsPickerController
has aUzysGroupPickerView
property that it initializes with thegroups
mutable array property in the picker controller's view did load process, and there are a few places in which the picker controller updates thegroups
property on itself without updating the groups property on thegroupPicker
.My observations seemed to be the opposite of what I was expecting when I hypothesized the issue, so I figured because you have a better understanding of how this all works perhaps you might know what the issue may be.
Either way this seemingly superfluous check to ensure that the groups count is greater than 0 before attempting to obtain an
objectAtIndex:
in thegroups
property of the picker view should at least prevent this crash in the short-term until the deeper cause is determined. Let me know what you think.