diff options
author | Paul Olav Tvete <paul.tvete@qt.io> | 2024-05-07 16:48:09 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@qt.io> | 2024-05-08 10:00:56 +0200 |
commit | e8950e3ed8d3acc48efb9cbc1ed3c25a9298a0db (patch) | |
tree | 2aa126c7b6521ff94e54f996ea3615e96fd21f34 | |
parent | f267ed7b12da0d48cff6b232c2f24948e83b216b (diff) |
Don't crash if QQuick3DViewport::setTouchpoint() is called with a
nullptr for a target.
Change-Id: If5a0d2c50829ccb34e773bc5d5312f6cd9b5ba81
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r-- | src/quick3d/qquick3dviewport.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/quick3d/qquick3dviewport.cpp b/src/quick3d/qquick3dviewport.cpp index fae29e49..24d42913 100644 --- a/src/quick3d/qquick3dviewport.cpp +++ b/src/quick3d/qquick3dviewport.cpp @@ -1309,10 +1309,12 @@ void QQuick3DViewport::setTouchpoint(QQuickItem *target, const QPointF &position QTouchEvent ev(type, m_syntheticTouchDevice, {}, points); - // Actually send event: - auto da = QQuickItemPrivate::get(t)->deliveryAgent(); - bool handled = da->event(&ev); - Q_UNUSED(handled); + if (t) { + // Actually send event: + auto da = QQuickItemPrivate::get(t)->deliveryAgent(); + bool handled = da->event(&ev); + Q_UNUSED(handled); + } // Duplicate logic from QQuickWindowPrivate::clearGrabbers if (ev.isEndEvent()) { |