Ah, yes, binding was involved. I still don't understand why the whole block exits though. Err, I guess I understand, but I don't like it. :) I have always wished the null checks worked a bit differently. Like it would be handy if we could say if( someObj.hasFoo ) and it would just evaluate to false if someObj was null. Oh well, a boy can dream...
Thanks Alex. Ben On Wed, Apr 2, 2008 at 12:53 PM, Alex Harui <[EMAIL PROTECTED]> wrote: > I get the RTE when I call greatFun(). Are you sure that wasn't part of > a binding expression evaluation? Those have catch blocks. > > > ------------------------------ > > *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On > Behalf Of *ben.clinkinbeard > *Sent:* Wednesday, April 02, 2008 7:25 AM > *To:* flexcoders@yahoogroups.com > *Subject:* [flexcoders] hasEventListener() on null object causes silent > failure and exit from block > > > > This seems like a bug to me. In the following code if dp is null, the > trace will not be executed. > > function greatFun():void > { > if( dp.hasEventListener( "foo" ) ) > { > // do stuff > } > trace( "WTF" ); > } > > It should either throw a RTE or just evaluate to false, shouldn't it? > > Thanks, > Ben > > >