• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSSelectorFromString crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSelectorFromString crash


  • Subject: Re: NSSelectorFromString crash
  • From: Chris Kane <email@hidden>
  • Date: Tue, 1 May 2001 18:22:14 -0700

On Tuesday, May 1, 2001, at 07:39 AM, Stefan Jung wrote:

Hello,

I was able to crash NSSelectorFromString with a little help from
the following code:

- (SEL)setAccessorFromIdentifier:(NSString *)identifier
{
NSString *string = [@"set" stringByAppendingString:
[[identifier capitalizedString]
stringByAppendingString:@":"]];
return NSSelectorFromString(string);
}

I think if you check 'string' before the call, you'll find it is nil, just before the crash. nil is not a valid parameter to NSSelectorFromString(). You can work around this by checking for string == nil yourself and returning (SEL)0 (as long as whatever code is calling setAccessorFromIdentifier: can handle that.

Chris Kane
Cocoa Framework, Apple, Inc.


  • Follow-Ups:
    • Re: NSSelectorFromString crash
      • From: Stefan Jung <email@hidden>
References: 
 >NSSelectorFromString crash (From: Stefan Jung <email@hidden>)

  • Prev by Date: Re: NSSelectorFromString crash
  • Next by Date: Re: loading executable code, NSBundle
  • Previous by thread: Re: NSSelectorFromString crash
  • Next by thread: Re: NSSelectorFromString crash
  • Index(es):
    • Date
    • Thread