We have moved to a new Sailfish OS Forum. Please start new discussions there.

Revision history [back]

click to hide/show revision 1
initial version

posted 2016-06-17 10:14:06 +0200

How to get rid of: TypeError: 'parent' of null @ Util.js:38 ?

In my QML/JS app, why I get every time the initial page is opened, a warning is written to the console? (the warning seems harmless anyhow, but...)

 [W] unknown:38 - file:///usr/lib/qt5/qml/Sailfish/Silica/private/Util.js:38: TypeError: Cannot read property 'parent' of null

Looking at the code, the Util page gets a null parent, clear. Why is that? I had the same problem with some other pages, and it seemed to help that I declare all the offending pages in the <application-name.qml> which is invoked right from C++, inside a Component.

ApplicationWindow
{
    id: appWindow

---8<--
    Component {
        id: anotherPage
        AnotherPage {}
    }

    Component {
        id: firstPage
        FirstPage {}
    }

    initialPage: firstPage
---8<---
}

The pages are written in their own QML files, of course.

What's the problem, or is this just a charcteristic which just has to be ignored? In my opinion, the errors and warnings should be fixed in applications, or at least there should be a reason to leave them put.

How to get rid of: TypeError: 'parent' of null @ Util.js:38 ?

In my QML/JS app, why I get every time the initial page is opened, a warning is written to the console? (the warning seems harmless anyhow, but...)

 [W] unknown:38 - file:///usr/lib/qt5/qml/Sailfish/Silica/private/Util.js:38: TypeError: Cannot read property 'parent' of null

Looking at the code, the Util page gets a null parent, clear. Why is that? that?

function findFlickable(item) {
    var parentItem = item.parent

I had the same problem with some other pages, and it seemed to help that I declare all the offending pages in the <application-name.qml> which is invoked right from C++, inside a Component.

ApplicationWindow
{
    id: appWindow

---8<--
    Component {
        id: anotherPage
        AnotherPage {}
    }

    Component {
        id: firstPage
        FirstPage {}
    }

    initialPage: firstPage
---8<---
}

The pages are written in their own QML files, of course.

course. As Pages:

Page {
    id: firstPage

What's the problem, or is this just a charcteristic which just has to be ignored? In my opinion, the errors and warnings should be fixed in applications, or at least there should be a reason to leave them put.

How to get rid of: TypeError: 'parent' of null @ Util.js:38 ?

In my QML/JS app, why I get every time the initial page is opened, a warning is written to the console? (the warning seems harmless anyhow, but...)

 [W] unknown:38 - file:///usr/lib/qt5/qml/Sailfish/Silica/private/Util.js:38: TypeError: Cannot read property 'parent' of null

Looking at the code, the Util page gets a null parent, clear. Why is that?

function findFlickable(item) {
    var parentItem = item.parent

I had the same problem with some other pages, and it seemed to help that I declare all the offending pages in the <application-name.qml> which is invoked right from C++, inside a Component.

ApplicationWindow
{
    id: appWindow

---8<--
    Component {
        id: anotherPage
        AnotherPage {}
    }

    Component {
        id: firstPage
        FirstPage {}
    }

    initialPage: firstPage
---8<---
}

The pages are written in their own QML files, of course. As Pages:

Page {
    id: firstPage

What's the problem, or is this just a charcteristic which just has to be ignored? In my opinion, the errors and warnings should be fixed in applications, or at least there should be a reason to leave them put.