On Thu, Jan 28, 2016 at 9:37 AM, Sam Bull <[email protected]> wrote:
> I have a custom component used as a delegate in a ListView. When this
> object is removed I get the error:
>
>     TypeError: Cannot read property of null
>
> This is occurring on the rather standard line:
>
>     anchors { left: parent.left; right: parent.right }
>
> So, how am I supposed to clean up this error? The only thing I can
> think of, is a hacky looking bit of code like:
>
>     anchors { left: (index == -1) ? 0 : parent.left; right: (index ==
>     -1) ? 0 : parent.right }

Try:

  anchors {
    left: parent ? parent.left : undefined
    right: parent ? parent.right : undefined
  }

HTH,

 Olivier

-- 
Mailing list: https://launchpad.net/~ubuntu-phone
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~ubuntu-phone
More help   : https://help.launchpad.net/ListHelp

Reply via email to