pengwang
pengwang

Reputation: 19956

NSArrayM objectAtIndex: index 5 beyond bounds for empty array

I'm trying to use the code from here: https://github.com/leah/PullToRefresh

but when I too big of a "pull height", I get a crash and this message:

NSArrayM objectAtIndex: index 5 beyond bounds for empty array

If my tableview cell only visit 4 cells, the crash message is instead

NSArrayM objectAtIndex: index 4 beyond bounds for empty array

etc. Please advise.

Upvotes: 0

Views: 1101

Answers (1)

Nicolas Miari
Nicolas Miari

Reputation: 16246

Of course it is beyond bounds: your array is empty, you can not extract any object form it.

If the array has n objects, you can retrieve up to index n - 1. An empty array has 0 objects, so you can not even retrieve index 0.

Upvotes: 1

Related Questions