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: Serg Stoyan
Subject: Re: Project Center segfault and nil objects
Date: Sun, 3 Jul 2005 02:05:53 +0300
User-agent: KMail/1.7.2

On Friday 24 June 2005 10:54, David Ayers wrote:
> 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.

Hmm... It works fine for me (no segfault). So is it depends on operating 
system runtime or compiler? Anyway I've added check for ttWidow value.

-- 
Serg Stoyan




reply via email to

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