• 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
Help with detecting invalid object when in if() test....
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help with detecting invalid object when in if() test....


  • Subject: Help with detecting invalid object when in if() test....
  • From: "Steven M.Palm" <email@hidden>
  • Date: Fri, 15 Aug 2003 09:19:42 -0500

I know this sounds very basic, but I can't seem to get it right.

I have the following:

sig = [bEnd mySig];

And this doesn't always return a valid object... If I try to use the name method on sig, [sig name], it will generate an exception if sig is not a valid object, -[NSNull name]: selector not recognized.

Okay, I thought I would just put the code that acts on sig inside an if statement...

if (sig) { blah }

But it still gets executed and causes the same exception.

I thought these might work:

if (sig == NULL)
if (sig == nil)

But neither worked.

Then, thinking that NSNull is a global object I tried this comparison...

if (sig == [NSNull null])

which also failed.

Finally, I reached success with:

if ([sig isEqualTo:NULL])

But I am curious why the others all failed.

Thanks!

--- DO NOT EDIT
--- This signature is used by MailEnhancer.mailbundle.
--- This signature is automatically replaced with a signature that has
--- the same name as the account you are sending from.
--- If no signature matching the account is found, no signature is used.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Help with detecting invalid object when in if() test....
      • From: "Steven M.Palm" <email@hidden>
    • Re: Help with detecting invalid object when in if() test....
      • From: "Alastair J.Houghton" <email@hidden>
  • Prev by Date: Determining the type of mount point (eg. floppy, cdrom, remote)
  • Next by Date: Re: inheritance and initialisation
  • Previous by thread: Determining the type of mount point (eg. floppy, cdrom, remote)
  • Next by thread: Re: Help with detecting invalid object when in if() test....
  • Index(es):
    • Date
    • Thread