• 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: crash in outlineView:isGroupItem:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: crash in outlineView:isGroupItem:


  • Subject: Re: crash in outlineView:isGroupItem:
  • From: "Joan Lluch (casa)" <email@hidden>
  • Date: Sun, 8 Jun 2008 23:04:05 +0200


El 08/06/2008, a las 22:11, Kyle Sluder escribió:

On Sun, Jun 8, 2008 at 1:37 PM, Joan Lluch (casa) <email@hidden> wrote:
  return ( item && [[item representedObject] isKindOfClass:[GroupNode
class]] ) ;

Style note: you don't need to do this. [[item representedObject] isKindOfClass:[GroupNode class]] will work just fine, because messages to nil return zero or their logical equivalent. So if item == nil, then [item representedObject] == nil, which means that [[item representedObject] isKindOfClass:[GroupNode class]] == NO.

Of course, this all works only if the GroupNode class exists.  ;-)

--Kyle Sluder

Yes, of course, objective-C allows you to send messages to nil but coming from a c++ background I just am used to do check for nullity first. On the other hand, checking an object for nil in an early stage will in some cases give a performance improvement. Not in the above code, obviously. :)_______________________________________________


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


References: 
 >crash in outlineView:isGroupItem: (From: "Joan Lluch (casa)" <email@hidden>)
 >Re: crash in outlineView:isGroupItem: (From: "Kyle Sluder" <email@hidden>)

  • Prev by Date: Re: simple text compression in Cocoa
  • Next by Date: crash in outlineView:isGroupItem:
  • Previous by thread: Re: crash in outlineView:isGroupItem:
  • Next by thread: crash in outlineView:isGroupItem:
  • Index(es):
    • Date
    • Thread