From 6fdb573a4abfa2ebc2052640a764ad40bb97ab4c Mon Sep 17 00:00:00 2001 From: Alexander Tuxen <tuxen@silpion.de> Date: Mon, 14 Nov 2022 16:19:45 +0100 Subject: [PATCH] fixed Segfault in compositor-message --- compositor-message/main.cpp | 15 ++++++++++----- multiscreen-compositor/qml/main.qml | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/compositor-message/main.cpp b/compositor-message/main.cpp index 1a3bad7..b3b2721 100644 --- a/compositor-message/main.cpp +++ b/compositor-message/main.cpp @@ -24,17 +24,22 @@ int main(int argc, char *argv[]) } QString command; - bool ok; + bool ok = false; qint32 windowid = -1; qint32 screenid = -1; command = QString(args[0]); - windowid = qint32(args[1].toInt(&ok)); - if(ok){ - if(args.length() > 2){ - screenid = qint32(args[2].toInt(&ok)); + if(args.length() > 1){ + windowid = qint32(args[1].toInt(&ok)); + if(ok){ + if(args.length() > 2){ + screenid = qint32(args[2].toInt(&ok)); + } } } + else + ok = true; + if(! ok){ QTextStream(stdout) << "windowid or screenid could not be parsed as integer."; parser.showHelp(); diff --git a/multiscreen-compositor/qml/main.qml b/multiscreen-compositor/qml/main.qml index d552ced..2944357 100644 --- a/multiscreen-compositor/qml/main.qml +++ b/multiscreen-compositor/qml/main.qml @@ -405,7 +405,7 @@ WaylandCompositor { var affectedSurfaces = getActiveSurfaces(getPidFromIviId(windowid)); if (affectedSurfaces.length === 0) { - console.log("no screens found for ID", windowid); + console.log("no screens found for IVI ID", windowid); server.returnStatus(-1); return; } -- GitLab