Re: Mystifying index out of bounds error
Re: Mystifying index out of bounds error
- Subject: Re: Mystifying index out of bounds error
- From: Mike Abdullah <email@hidden>
- Date: Thu, 01 Nov 2012 14:50:09 +0000
On 1 Nov 2012, at 14:37, Antonio Nunes <email@hidden> wrote:
> On 1 Nov, 2012, at 15:24 , Mike Abdullah <email@hidden> wrote:
>
>> Well that sounds an impossible problem, but might not be. Give us the crash report too.
>
> 12/10/2012 12:41:10: -[__NSCFConstantString characterAtIndex:]: Range or index out of bounds
> 12/10/2012 12:41:10: (
> 0 CoreFoundation 0x00007fff9354a0a6 __exceptionPreprocess + 198
> 1 libobjc.A.dylib 0x00007fff8ba543f0 objc_exception_throw + 43
> 2 CoreFoundation 0x00007fff93549e7c +[NSException raise:format:] + 204
> 3 CoreFoundation 0x00007fff9350e8ee -[__NSCFString characterAtIndex:] + 94
> 4 PDF Nomad 0x000000010380b5fe PDF Nomad + 1205758 ( -> -[ANBorderedTextView keyDown:] (in PDF Nomad) (ANBorderedTextView.m:91) )
> 5 AppKit 0x00007fff8a9ba120 -[NSWindow sendEvent:] + 9687
> 6 AppKit 0x00007fff8a9b5744 -[NSApplication sendEvent:] + 5761
> 7 AppKit 0x00007fff8a8cb2fa -[NSApplication run] + 636
> 8 AppKit 0x00007fff8a86fcb6 NSApplicationMain + 869
> 9 PDF Nomad 0x00000001036e6f84 PDF Nomad + 8068
> )
>
> Unfortunately, I did not receive a full crash report, so I can't show register contents.
>
> -António
>
>
>> On 1 Nov 2012, at 12:11, Antonio Nunes <email@hidden> wrote:
>>
>>> Hi,
>>>
>>> I have this code in my app:
>>>
>>> - (void)keyDown:(NSEvent *)theEvent
>>> {
>>> unichar oneChar;
>>> NSString *theChars = [theEvent charactersIgnoringModifiers];
>>>
>>> if ( 0 == theChars.length ) {
>>> return;
>>> }
>>>
>>> oneChar = [theChars characterAtIndex:0];
>>>
>>> …
>>> }
Well it all looks like your code shouldn't be able to give the above exception. To check, there's no other calls to -characterAtIndex: in the code you omitted? And the code you pasted is from ANBorderedTextView?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden