aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickevents.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2019-12-16 09:02:39 +0000
committerShawn Rutledge <shawn.rutledge@qt.io>2020-01-31 17:04:44 +0000
commitb712003dce1c4cf96a72ffb2ef2e3176dddf7979 (patch)
treeb46565f25198d7f0dd5caef520845862c2d30744 /src/quick/items/qquickevents.cpp
parente3303da40b6af2d4b6d0d1512809a849085d207f (diff)
QQuickPointerMouseEvent::asMouseEvent(): check for nullptr
It could potentially crash if e.g. we're handling a Leave event, because QQuickWindowPrivate::clearHover() creates a QQuickPointerEvent in which m_event is null. Change-Id: I15d6db3c74fcd4979a36b3f1d0c935e6400032a6 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/items/qquickevents.cpp')
-rw-r--r--src/quick/items/qquickevents.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp
index 87708e1483..0a6faf04af 100644
--- a/src/quick/items/qquickevents.cpp
+++ b/src/quick/items/qquickevents.cpp
@@ -1626,6 +1626,8 @@ bool QQuickSinglePointEvent::allPointsGrabbed() const
QMouseEvent *QQuickPointerMouseEvent::asMouseEvent(const QPointF &localPos) const
{
+ if (!m_event)
+ return nullptr;
auto event = static_cast<QMouseEvent *>(m_event);
event->setLocalPos(localPos);
return event;