FLEX-34634 - add null check (patch provided by Gareth Daniel Smith) Signed-off-by: Erik de Bruin <e...@ixsoftware.nl>
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/a50a8d0e Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/a50a8d0e Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/a50a8d0e Branch: refs/heads/iso7skins Commit: a50a8d0ed7b61686704c9d11224c91f9e6083026 Parents: afd12ba Author: Erik de Bruin <e...@ixsoftware.nl> Authored: Tue Nov 18 09:17:41 2014 +0100 Committer: Erik de Bruin <e...@ixsoftware.nl> Committed: Tue Nov 18 09:17:41 2014 +0100 ---------------------------------------------------------------------- frameworks/projects/spark/src/spark/components/DataGroup.as | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/a50a8d0e/frameworks/projects/spark/src/spark/components/DataGroup.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/spark/src/spark/components/DataGroup.as b/frameworks/projects/spark/src/spark/components/DataGroup.as index be4f51d..e946e30 100644 --- a/frameworks/projects/spark/src/spark/components/DataGroup.as +++ b/frameworks/projects/spark/src/spark/components/DataGroup.as @@ -1751,7 +1751,7 @@ public class DataGroup extends GroupBase implements IItemRendererOwner virtualRendererIndices.splice(vrItemIndex, 1); } - // Remove the old renderer at index from indexToRenderer[], from the + // Remove the old renderer at index (if any) from indexToRenderer[], from the // DataGroup, and clear its data property (if any). const oldRenderer:IVisualElement = indexToRenderer[index]; @@ -1759,6 +1759,8 @@ public class DataGroup extends GroupBase implements IItemRendererOwner if (indexToRenderer.length > index) indexToRenderer.splice(index, 1); + if (oldRenderer) + { dispatchEvent(new RendererExistenceEvent( RendererExistenceEvent.RENDERER_REMOVE, false, false, oldRenderer, index, item)); @@ -1768,6 +1770,7 @@ public class DataGroup extends GroupBase implements IItemRendererOwner var child:DisplayObject = oldRenderer as DisplayObject; if (child) super.removeChild(child); + } invalidateSize(); invalidateDisplayList();