From 288a459c93971aea745610c6f3a7553a2b1a1db6 Mon Sep 17 00:00:00 2001 From: dreamsourcelabTAI Date: Mon, 22 Jan 2024 18:06:20 +0800 Subject: [PATCH] fix: print a invalid screen index --- DSView/pv/mainframe.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/DSView/pv/mainframe.cpp b/DSView/pv/mainframe.cpp index 26e03597..948c5e75 100644 --- a/DSView/pv/mainframe.cpp +++ b/DSView/pv/mainframe.cpp @@ -523,7 +523,16 @@ void MainFrame::readSettings() move(left, top); #endif showMaximized(); // show max by system api - dsv_info("show as max, screen:%s", QGuiApplication::screens().at(scrIndex)->name().toStdString().c_str()); + + QString scrName; + if (scrIndex == -1){ + scrName = QGuiApplication::primaryScreen()->name(); + } + else{ + scrName = QGuiApplication::screens().at(scrIndex)->name(); + } + + dsv_info("show as max, screen:%s", scrName.toStdString().c_str()); } else if (bReset) {