aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Fella <nicolas.fella@kde.org>2024-03-01 22:44:05 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-04-02 14:33:33 +0000
commitc53c2181c901edaa3e238d5805674849b82d5264 (patch)
treecd348c30cab991bf2fe49a188682a2ce640581a4
parent11fecaea0398c5247158aebe2a07a50c72d9c046 (diff)
QQuickSelectionRectangle: Fix crash when target is null
Change-Id: I9eb92583f2cfe1a0a6bee54e3e3f31528c3b6993 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit ab88fcd990523070f2c018f4599b9bfa023d3b95) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 47cf611d54938d0b7916aa72167b52f50b846723)
-rw-r--r--src/quicktemplates/qquickselectionrectangle.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quicktemplates/qquickselectionrectangle.cpp b/src/quicktemplates/qquickselectionrectangle.cpp
index f4543f0572..7ef9996aae 100644
--- a/src/quicktemplates/qquickselectionrectangle.cpp
+++ b/src/quicktemplates/qquickselectionrectangle.cpp
@@ -491,7 +491,7 @@ void QQuickSelectionRectanglePrivate::updateSelectionMode()
m_tapHandler->setEnabled(enabled);
if (m_selectionMode == QQuickSelectionRectangle::Auto) {
- if (qobject_cast<QQuickScrollView *>(m_target->parentItem())) {
+ if (m_target && qobject_cast<QQuickScrollView *>(m_target->parentItem())) {
// ScrollView allows flicking with touch, but not with mouse. So we do
// the same here: you can drag to select with a mouse, but not with touch.
m_effectiveSelectionMode = QQuickSelectionRectangle::Drag;