[ https://issues.apache.org/jira/browse/FLEX-14181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13675815#comment-13675815 ]
Justin Mclean commented on FLEX-14181: -------------------------------------- Code to reproduce. <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" initialize="init(event)"> <fx:Script> <![CDATA[ import mx.containers.HBox; import mx.containers.HDividedBox; import mx.events.FlexEvent; protected function init(event:FlexEvent):void { var box:HDividedBox = new HDividedBox(); box.addChild(new HBox()); box.addChild(new HBox()); box.addChild(new HBox()); var divider:Object = box.getDividerAt(10); } ]]> </fx:Script> </s:Application> > DividedBox call to getDividerAt(num) encounters null reference when no > dividers are present > ------------------------------------------------------------------------------------------- > > Key: FLEX-14181 > URL: https://issues.apache.org/jira/browse/FLEX-14181 > Project: Apache Flex > Issue Type: Bug > Components: mx: DividedBox > Affects Versions: Adobe Flex SDK 3.0 (Release) > Environment: Affected OS(s): Windows > Affected OS(s): Windows XP > Browser: Firefox 2.x > Language Found: English > Reporter: Adobe JIRA > Labels: easyfix, easytest > > What I am doing is programatically adding items to an HDividedBox. There may > or may not be any components added to the dividerbox. Then later when I make > a call to getDividerAt(i) I get the exception. I believe the member > dividedLayer of DividedBox is null since nothing was added to it. > Steps to reproduce: > 1. Create a DividedBox, or in my case an HDividedBox > 2. Make a call to the divider.getDividerAt(some number) > 3. It blows up with a null reference. The null reference actually being the > dividerLayer. > > Actual Results: > TypeError: Error #1009: Cannot access a property or method of a null object > reference. > at > mx.containers::DividedBox/getDividerAt()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\containers\DividedBox.as:697] > at > components::DataContainer/commitProperties()[C:\development\workspace\Components\src\components\DataContainerHelper.as:111] > at > mx.core::UIComponent/validateProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:5670] > at > mx.managers::LayoutManager/validateProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:519] > at > mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:639] > at Function/http://adobe.com/AS3/2006/builtin::apply() > at > mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8460] > at > mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8403] > > Expected Results: > I would expect to get a null value returned to me if either there was no > dividerLayer or the item at the index was null. > > Workaround (if any): > From what I can tell there is no getDividerCount method to check before > making the call. -- 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