vcl/qt5/Qt5Frame.cxx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
New commits: commit f806a2832aee62efc0e0404f7c24d53aaaf814d0 Author: Katarina Behrens <katarina.behr...@cib.de> AuthorDate: Mon Oct 22 16:35:21 2018 +0200 Commit: Katarina Behrens <katarina.behr...@cib.de> CommitDate: Tue Oct 23 09:11:21 2018 +0200 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.behr...@cib.de> 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); + } + } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits