From 5d7f1133205d14002463456c26a97f8ba17d69b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 7 Aug 2019 13:15:51 +0200 Subject: Add nullptr guard to QHighDScaling::scaleAndOrigin(QPlatformScreen *) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit b6ded193 added an unconditional dereference of the platformScreen pointer, for calls where nativePostion is non-nullptr. Change-Id: I4a6fbbd0337f91d4fcb76c17b4dc60e1b9ad10ed Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qhighdpiscaling.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index 0fea416404..64f1397771 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -456,6 +456,8 @@ QHighDpiScaling::ScaleAndOrigin QHighDpiScaling::scaleAndOrigin(const QPlatformS { if (!m_active) return { qreal(1), QPoint() }; + if (!platformScreen) + return { m_factor, QPoint() }; // the global factor const QPlatformScreen *actualScreen = nativePosition ? platformScreen->screenForPosition(*nativePosition) : platformScreen; return { m_factor * screenSubfactor(actualScreen), actualScreen->geometry().topLeft() }; -- cgit v1.2.3