diff options
author | André de la Rocha <andre.rocha@qt.io> | 2022-05-13 22:18:14 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-05-16 11:57:04 +0000 |
commit | d9f17add9ec65696eac92d1b72b406f01420ebb2 (patch) | |
tree | f258ce52d30a967334e5d69ce324d5eba4629a9c /src | |
parent | ba91807003b49f61e65a4958241ab4699a1c2fbb (diff) |
Fix null pointer dereference in GUI-less applications
A pointer to the primary screen, which in GUI-less applications
is null, was being dereferenced without testing, resulting in a
crash when using the camera.
Fixes: QTBUG-103394
Change-Id: Id891423bba585b474adab079521287677e8c8075
Reviewed-by: Piotr Srebrny <piotr.srebrny@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 4b73ae6531c4bf9da7309ac12e218f432a227daf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/multimedia/video/qvideooutputorientationhandler.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/multimedia/video/qvideooutputorientationhandler.cpp b/src/multimedia/video/qvideooutputorientationhandler.cpp index 2a6781b47..86e6bd664 100644 --- a/src/multimedia/video/qvideooutputorientationhandler.cpp +++ b/src/multimedia/video/qvideooutputorientationhandler.cpp @@ -51,6 +51,8 @@ QVideoOutputOrientationHandler::QVideoOutputOrientationHandler(QObject *parent) , m_currentOrientation(0) { QScreen *screen = QGuiApplication::primaryScreen(); + if (!screen) + return; connect(screen, SIGNAL(orientationChanged(Qt::ScreenOrientation)), this, SLOT(screenOrientationChanged(Qt::ScreenOrientation))); @@ -69,6 +71,8 @@ void QVideoOutputOrientationHandler::screenOrientationChanged(Qt::ScreenOrientat return; const QScreen *screen = QGuiApplication::primaryScreen(); + if (!screen) + return; const int angle = (360 - screen->angleBetween(screen->nativeOrientation(), orientation)) % 360; |