discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Project Center segfault and nil objects


From: David Ayers
Subject: Re: Project Center segfault and nil objects
Date: Fri, 24 Jun 2005 09:54:57 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511

Duncan Anker wrote:

> I was of the belief that it is legal to send messages to nil in
> Objective C, and nothing would happen. This is supposed to be one of the
> benefits of it after all, not having to check every object before
> sending a message. Given that assumption is true then, is it possible
> that nil has a different value between the Project Center support
> libraries and the Objective C runtime?

In general it is safe to send messages to nil objects.  But in this case
the return value is a structure of which specific components are accessed:

  origin = NSMakePoint(mouseLocation.x + 8,
                       mouseLocation.y - 16 - [ttWindow frame].size.height);

If a method returns a structure, it must be protected by a test to
insure the receiver is not nil.

Cheers,
David




reply via email to

[Prev in Thread] Current Thread [Next in Thread]