summaryrefslogtreecommitdiff
path: root/vcl/qt5/Qt5Frame.cxx
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2018-10-22 16:35:21 +0200
committerKatarina Behrens <Katarina.Behrens@cib.de>2018-10-23 09:11:21 +0200
commitf806a2832aee62efc0e0404f7c24d53aaaf814d0 (patch)
treeb1d8cd610fd7d67a242649843c13c9975f36a71a /vcl/qt5/Qt5Frame.cxx
parent4e0580dc2d05ff37d813cb573e0b57f3451fb2fd (diff)
tdf#120451: Use primary screen if requested screen doesn't exist
Change-Id: I3e570bdeddc82f1d8cd46a362964e53527e6c152 Reviewed-on: https://gerrit.libreoffice.org/62193 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'vcl/qt5/Qt5Frame.cxx')
-rw-r--r--vcl/qt5/Qt5Frame.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index ff77638013ca..4847546f200d 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -839,7 +839,17 @@ void Qt5Frame::SetScreenNumber(unsigned int nScreen)
{
QWindow* const pWindow = windowHandle();
if (pWindow)
- pWindow->setScreen(QApplication::screens()[nScreen]);
+ {
+ QList<QScreen*> screens = QApplication::screens();
+ if (static_cast<int>(nScreen) < screens.size())
+ pWindow->setScreen(QApplication::screens()[nScreen]);
+ else
+ {
+ // index outta bounds, use primary screen
+ QScreen* primaryScreen = QApplication::primaryScreen();
+ pWindow->setScreen(primaryScreen);
+ }
+ }
}
}