[plasma/libkscreen] src/doctor: doctor: fix position parsing where ok variable was overwritten

Vlad Zahorodnii <[email protected]> Tue, 4 Aug 2026 12:44:53 +0000 (UTC)
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit bae41bd497c3ae121eb750b6455705a381a92042 by Vlad Zahorodnii, on behalf of zhang shoucheng.
Committed on 04/08/2026 at 12:37.
Pushed by vladz into branch 'master'.

doctor: fix position parsing where ok variable was overwritten

M  +5    -3    src/doctor/doctor.cpp

https://invent.kde.org/plasma/libkscreen/-/commit/bae41bd497c3ae121eb750b6455705a381a92042

diff --git a/src/doctor/doctor.cpp b/src/doctor/doctor.cpp
index f884de4e..80d48e66 100644
--- a/src/doctor/doctor.cpp
+++ b/src/doctor/doctor.cpp
@@ -230,9 +230,11 @@ void Doctor::parseOutputArgs()
                         qApp->exit(5);
                         return;
                     }
-                    int x = _pos[0].toInt(&ok);
-                    int y = _pos[1].toInt(&ok);
-                    if (!ok) {
+                    bool okX = false;
+                    bool okY = false;
+                    int x = _pos[0].toInt(&okX);
+                    int y = _pos[1].toInt(&okY);
+                    if (!okX || !okY) {
                         cerr << "Unable to parse position: " << ops[3] << Qt::endl;
                         qApp->exit(5);
                         return;