ios - *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 5 beyond bounds [0 .. 4]' -


i getting * terminating app due uncaught exception 'nsrangeexception', reason: '*

i not getting exact issue please me on this

- (nsmutablearray*) arrayatpointindex:(nsinteger) index {     nsmutablearray * array = [[nsmutablearray alloc] init];     if ( series )     {         (int plotindex = 0; plotindex <= [_points count]; plotindex++) {             salchartcoordinate * coord1 = [_points objectatindex:plotindex];             cgfloat differ = abs( [[coord1.series objectatindex:index] floatvalue] );             [array addobject:[nsnumber numberwithfloat:differ]];         }      }     if ( [array count] > 0 )         return [array autorelease];      [array release];     return nil; } 

the possible place : [coord1.series objectatindex:index]

because not checking nsarray series size , plotindex.

put condition this

if(coord1.series.count-1 <= index) {      cgfloat differ = abs( [[coord1.series objectatindex:plotindex] floatvalue] );      [array addobject:[nsnumber numberwithfloat:differ]]; } 

note: accessing array , inner array same index. can not said sure indicating logic problem. check that.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -