Re: Question about an NSScanner loop
Re: Question about an NSScanner loop
- Subject: Re: Question about an NSScanner loop
- From: j o a r <email@hidden>
- Date: Wed, 12 Jan 2005 23:16:25 +0100
On 2005-01-12, at 22.48, Matt Crocker wrote:
NSScanner *cellScanner = [NSScanner
scannerWithString:[inputString
substringWithRange:NSMakeRange(inputIndex, [inputString
length]-inputIndex)]];
cellScanner is an autoreleased object...
[cellScanner scanUpToCharactersFromSet:[NSCharacterSet
characterSetWithCharactersInString:@",\n"] intoString:&cellString];
Should you not check the return value? Add a check to see that this
returns YES!
[cellScanner release];
...you release the autorelease object. This is a memory management
error, and would have crashed, had you not been in your never ending
loop...
After you've found something by using "scanUpToString...", you need to
scan *past* that point in the string by using "scanString...", or else
you'll get "stuck". This is probably the reason why the loop never
ends.
Let's start with these things - return to the list if you don't find
the problem with why the loop never ends.
j o a r
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden