mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Guard against window being off-screen
QDesktopWidget::screenNumber can return -1
This commit is contained in:
@@ -385,7 +385,7 @@ namespace BlackGui
|
||||
{
|
||||
const QWidget *w = CGuiApplication::mainApplicationWidget();
|
||||
const int s = QApplication::desktop()->screenNumber(w);
|
||||
if (s < QGuiApplication::screens().size()) { return QGuiApplication::screens().at(s); }
|
||||
if (s >= 0 && s < QGuiApplication::screens().size()) { return QGuiApplication::screens().at(s); }
|
||||
return QGuiApplication::primaryScreen();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user