You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by "Alex Harui (JIRA)" <ji...@apache.org> on 2012/11/05 20:44:12 UTC

[jira] [Updated] (FLEX-28967) PopUpManagerImpl - centerPopUp method - TypeError: Error #1009: Cannot access a property or method of a null object reference

     [ https://issues.apache.org/jira/browse/FLEX-28967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Harui updated FLEX-28967:
------------------------------

    Labels: EasyFix  (was: )
    
> 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
>              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