[ 
https://issues.apache.org/jira/browse/FLEX-28967?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13612071#comment-13612071
 ] 

Carlos Rovira commented on FLEX-28967:
--------------------------------------

The Fix by miroslav.havrlent was tested and work successfully. It was 
introduced in develop
                
> PopUpManagerImpl - centerPopUp method - TypeError: Error #1009: Cannot access 
> a property or method of a null object reference
> -----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FLEX-28967
>                 URL: https://issues.apache.org/jira/browse/FLEX-28967
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: PopUp Manager
>    Affects Versions: Adobe Flex SDK Previous
>         Environment: Affected OS(s): All OS Platforms
> Affected OS(s): All OS Platforms
> Browser: Internet Explorer 8.x
> Language Found: English
>            Reporter: Adobe JIRA
>            Assignee: Carlos Rovira
>              Labels: EasyFix
>
> Steps to reproduce:
> 1. using PopUpManager
>  
> Error in the code:
> public function centerPopUp(popUp:IFlexDisplayObject):void
>     {        
>         if (popUp is IInvalidating)
>             IInvalidating(popUp).validateNow();
>         const o:PopUpData = findPopupInfoByOwner(popUp);
>         
>         // If we don't find the pop owner or if the owner's parent is not 
> specified or is not on the
>         // stage, then center based on the popUp's current parent.
>         var popUpParent:DisplayObject = (o && o.parent && o.parent.stage) ? 
> o.parent : popUp.parent;
>         if (popUpParent)
>         {
>             var systemManager:ISystemManager = o.systemManager;
> .
> .
> .
> .
> If const "o" is null, popUpParent is set to popUp.parent as stated by 
> condition above.
> However in next step you assume that const "o" exists because you're asking 
> for o.systemManager, but o is null.
> Therefore: TypeError: Error #1009: Cannot access a property or method of a 
> null object reference
> Fix:
> public function centerPopUp(popUp:IFlexDisplayObject):void
>     {        
>         if (popUp is IInvalidating)
>             IInvalidating(popUp).validateNow();
>         const o:PopUpData = findPopupInfoByOwner(popUp);
>         
>         var popUpParent:DisplayObject = (o && o.parent && o.parent.stage) ? 
> o.parent : popUp.parent;
>         if (popUpParent)
>         {
>                       var systemManager:ISystemManager;
>                       if (o != null) {
>                               systemManager = o.systemManager;
>                       } else if (popUpParent.hasOwnProperty("systemManager")) 
> {
>                               systemManager = popUpParent["systemManager"];
>                       } else if (popUpParent is ISystemManager) {
>                               systemManager = popUpParent as ISystemManager;
>                       }
>                       
>                       if (!systemManager)
>                               return; // or throw exception maybe ?
> .
> .
> .
> .

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to