diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 5f4daced732..c1d209eb865 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3754,7 +3754,8 @@ static inline void formatTouchEvent(QDebug d, const QTouchEvent &t) { d << "QTouchEvent("; QtDebugUtils::formatQEnum(d, t.type()); - d << " device: " << t.device()->name(); + const auto* device = t.device(); + d << " device: " << device ? device->name() : "No device"; d << " states: "; QtDebugUtils::formatQFlags(d, t.touchPointStates()); d << ", " << t.points().size() << " points: " << t.points() << ')';