From 3a2f056e8adf07f31ea1f6b2856a6d57da1f4777 Mon Sep 17 00:00:00 2001 From: Silarn Date: Wed, 3 Jul 2019 14:12:38 -0500 Subject: More refactoring --- src/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index b83e581b..1e60483f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -645,10 +645,13 @@ int runApplication(MOApplication &application, SingleInstance &instance, if (settings.contains("window_monitor")) { const int monitor = settings.value("window_monitor").toInt(); - if (monitor != -1) { + if (monitor != -1 && QGuiApplication::screens().size() > monitor) { QGuiApplication::screens().at(monitor)->geometry().center(); const QPoint center = QGuiApplication::screens().at(monitor)->geometry().center(); splash.move(center - splash.rect().center()); + } else { + const QPoint center = QGuiApplication::primaryScreen()->geometry().center(); + splash.move(center - splash.rect().center()); } } -- cgit v1.3.1