Skip to content

VerticalLayout without virtual layout throws error on drag/drop #1819

Open
@esidegallery

Description

@esidegallery

When dragging an item to the end of a list with a non-virtual vertical layout, the following error is thrown:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at feathers.layout::VerticalLayout/getDropIndex()[C:\Users\josht\Development\feathersui\feathersui-starling-sdk\frameworks\projects\feathers\feathers\source\feathers\layout\VerticalLayout.as:1643]

In VirticalLayout.as, item.y is accessed without testing for the existence of item.

Below is an example to recrate the issue:

<f:Application xmlns:f="library://ns.feathersui.com/mxml"
               xmlns:fx="http://ns.adobe.com/mxml/2009"
               theme="feathers.themes.MetalWorksMobileTheme">

    <fx:Script>
        <![CDATA[
            import feathers.data.ListCollection;
            import feathers.layout.VerticalLayout;
            
            override protected function initialize():void
            {
                super.initialize();
            
                list.dataProvider = new ListCollection([
                        "Item 1",
                        "Item 2",
                        "Item 3",
                        "Item 4"
                    ]);
                (list.layout as VerticalLayout).useVirtualLayout = false;
            }
        ]]>
    </fx:Script>

    <f:List id="list"
            dragEnabled="true"
            dropEnabled="true"/>

</f:Application>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions