Commit fb95ecbb authored by David Redondo's avatar David Redondo 🏎 Committed by Tomaz Canabrava
Browse files

Fix potential crash in flatpak instance

We are running an external command, we should not rely on the output
format being as expected.
parent c65b0b8d
Pipeline #241059 passed with stage
in 9 minutes and 1 second
......@@ -184,7 +184,10 @@ static QString defaultShell()
proc.setArguments({QStringLiteral("passwd"), QString::number(pw->pw_uid)});
KSandbox::startHostProcess(proc);
proc.waitForFinished();
return QString::fromUtf8(proc.readAllStandardOutput().simplified().split(':').at(6));
const auto output = proc.readAllStandardOutput().simplified();
if (auto parts = QString::fromUtf8(output).split(QLatin1Char(':')); output.size() >= 7) {
return parts.at(6);
}
}
return {};
#endif
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment