incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Harui (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (FLEX-28967) PopUpManagerImpl - centerPopUp method - TypeError: Error #1009: Cannot access a property or method of a null object reference
Date Mon, 05 Nov 2012 19:44:12 GMT

     [ 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

Mime
View raw message