summaryrefslogtreecommitdiff
path: root/vcl/qt5/Qt5Frame.cxx
diff options
context:
space:
mode:
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);
+ }
+ }
}
}