diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-05-19 12:46:16 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-05-28 15:32:17 +0000 |
commit | b6a7c9b1bde0f70a08f4f03b9a8a4328e7f8abee (patch) | |
tree | 89d70075d5819db6bc509cd676e64ad2c71a765f /src | |
parent | c5d381a5920379affe146957b6c2b9e80d5dccf4 (diff) |
QXcb: don't dereference pointer before checking
The virtualDesktop pointer is expected to be populated by queryPointer, but
that method handles the case that there either is no reply, or that the
reply doesn't match, in which case the pointer remains nullptr.
Don't dereference it afterwards without checking.
Addresses code checker warning a179d1087759bb6ca9c3380257bd70d6
Change-Id: I5877f26fd3b49327c0de3f2c918bb606bee8ac57
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c2258e85a32b66cf7cbc59a4789e68c31c9955be)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbcursor.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index 4b877deb30..fd62dbf012 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -668,7 +668,8 @@ void QXcbCursor::setPos(const QPoint &pos) { QXcbVirtualDesktop *virtualDesktop = nullptr; queryPointer(connection(), &virtualDesktop, nullptr); - xcb_warp_pointer(xcb_connection(), XCB_NONE, virtualDesktop->root(), 0, 0, 0, 0, pos.x(), pos.y()); + if (virtualDesktop) + xcb_warp_pointer(xcb_connection(), XCB_NONE, virtualDesktop->root(), 0, 0, 0, 0, pos.x(), pos.y()); xcb_flush(xcb_connection()); } |