title: [__NSArrayM objectAtIndex:]: index 517431040 beyond bounds [0 .. 48]
body: <p>I fond this error <a href="https://stackoverflow.com/questions/8936760/nsarraym-objectatindex-index-4294967295-beyond-bounds-for-empty-array-wit">here</a>, but it came to the conclusion that the error occurs because the array is empty. My array however is not empty.</p>
  
  <pre><code>-(void)setNumberInTippfield:(NSNumber *)aNumber{
    NSNumber *index = [self.ticket.currentSlip intValue]-1;
    NSLog(@"index: %i",index);//prints 0, expected
    Slip *slip = [self.slipArray objectAtIndex:index];
    NSNumber *number = [NSNumber numberWithInt:[aNumber intValue]-1 ];
    NSLog(@"number: %@",number);//prints out number, e.g. 25, as expected
    NSMutableArray *tNumberArray = [[NSMutableArray alloc] init];
    tNumberArray= [NSMutableArray arrayWithArray:slip.numberArray];
    //after this line, debugger tells me the array has 49 objects, as expected
    [[tNumberArray objectAtIndex:number] setSelected:YES];//this line throws exception
    //this line seems to get executed 3 times, as I can see from the breakpoints
  }
  </code></pre>
  
  <p>after that it throws an exception:</p>
  
  <pre><code>*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -
  [__NSArrayM objectAtIndex:]: index 517431040 beyond bounds [0 .. 48]'
  </code></pre>
  
  <p>I thought that <code>number</code> holds an adress instead of a value, but NSLog tells me the correct value. Any hints on that one? Thanks a lot in advance.</p>