diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-03-19 15:56:47 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-03-19 16:34:23 +0100 |
commit | 60b134d0d77a1eadf594eeab8d0cc7e85d7ce905 (patch) | |
tree | 15c36ecd392f67ff65500196f81f49583fc31404 /src/quicktemplates2 | |
parent | 01bfe33d56808344f12ad17f900395e85de84de5 (diff) |
Consistently check for nullptr
Since delegateItem might be nullptr after the qobject_cast, it might
still be nullptr even if d->tumbler is set. Don't dereference it without
checking first.
Fixes static analzyer warning 97aff83b6782555664df70d92f65e7dd.
Pick-to: 6.1
Change-Id: I70f4e27eaa5e26538884ead19ae12da7bacbd76b
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r-- | src/quicktemplates2/qquicktumbler.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquicktumbler.cpp b/src/quicktemplates2/qquicktumbler.cpp index 5f17cd29..4f7d3487 100644 --- a/src/quicktemplates2/qquicktumbler.cpp +++ b/src/quicktemplates2/qquicktumbler.cpp @@ -995,7 +995,7 @@ QQuickTumblerAttached::QQuickTumblerAttached(QObject *parent) QQuickTumblerPrivate *tumblerPrivate = QQuickTumblerPrivate::get(d->tumbler); tumblerPrivate->setupViewData(tumblerPrivate->contentItem); - if (delegateItem->parentItem() == tumblerPrivate->viewContentItem) { + if (delegateItem && delegateItem->parentItem() == tumblerPrivate->viewContentItem) { // This item belongs to the "new" view, meaning that the tumbler's contentItem // was probably assigned declaratively. If they're not equal, calling // calculateDisplacement() would use the old contentItem data, which is bad. |