Reputation: 397
I got this error from Crashlytics.
Fatal Exception NSRangeException * -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array
I looked into my code, it happens at this point as below:
CGPoint targetOffset = CGPointMake(currentEpisodeCellNumber * 90, 0);
I think if CGPointMake(0,0)
, I got a crash. But I am not sure this is main problem.
I cannot figure out how to fix this problem.
I added my codes
if (self.episodeNumber > 1) {
sceneNumber = [[[episodesArray objectAtIndex:1] objectForKey:@"scene"] intValue];
}
else {
sceneNumber = [[[episodesArray objectAtIndex:0] objectForKey:@"scene"] intValue];
}
currentEpisodeCellNumber = self.episodeNumber - sceneNumber;
CGPoint targetOffset = CGPointMake(currentEpisodeCellNumber * 90, 0);
I got error at this point, sceneNumber = [[[episodesArray objectAtIndex:0] objectForKey:@"scene"] intValue];
Upvotes: 0
Views: 142
Reputation: 131426
It looks to me like the crash you are getting from Crashlytics is not your CGPointMake function call.
The crash message is telling you that your are trying to fetch object 0 in an empty array. That's pretty clear. Your CGPointMake call does not reference any arrays. You need to look again as to the source line that's causing your crash.
Upvotes: 1