aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2019-10-10 16:11:07 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2019-10-17 06:18:02 +0200
commit4876b0b60a92cd028a821c7c1c095ed55fb15f68 (patch)
tree9727d99b874102042ab884395528d40b1a86af31
parent2affb0408e5a6647d6ec4692a2447276ac0c8fc8 (diff)
Handle null in QQuickPointerEvent and QQEventPoint debug operators
For example qDebug() << event->asMouseEvent() could crash if the event is not a mouse event. Change-Id: I34ffadeb9fc23f42d1d6939190c43a6486eea533 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
-rw-r--r--src/quick/items/qquickevents.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp
index 8303c3fed1..7d128b4a16 100644
--- a/src/quick/items/qquickevents.cpp
+++ b/src/quick/items/qquickevents.cpp
@@ -1937,6 +1937,10 @@ Q_QUICK_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const QQuickPointerEvent *e
{
QDebugStateSaver saver(dbg);
dbg.nospace();
+ if (!event) {
+ dbg << "QQuickPointerEvent(0)";
+ return dbg;
+ }
dbg << "QQuickPointerEvent(";
dbg << event->timestamp();
dbg << " dev:";
@@ -1957,6 +1961,10 @@ Q_QUICK_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const QQuickEventPoint *eve
{
QDebugStateSaver saver(dbg);
dbg.nospace();
+ if (!event) {
+ dbg << "QQuickEventPoint(0)";
+ return dbg;
+ }
dbg << "QQuickEventPoint(accepted:" << event->isAccepted()
<< " state:";
QtDebugUtils::formatQEnum(dbg, event->state());