Utils: Fix nullptr access when shell script process fails

When the QtcProcess failed to start, we immediately delete it.
Later it would try to access it to retrieve the command line
for the error message, which would crash.

Change-Id: Ibac942e9a1a91001d90ce7e73d5463c51af81590
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2022-11-09 17:05:35 +01:00
committed by Marcus Tillmanns
parent 50b749fc42
commit cb11763641

View File

@@ -182,6 +182,8 @@ bool DeviceShell::start()
setupShellProcess(m_shellProcess.get());
CommandLine cmdLine = m_shellProcess->commandLine();
m_shellProcess->setProcessMode(ProcessMode::Writer);
// Moving the process into its own thread ...
@@ -232,7 +234,7 @@ bool DeviceShell::start()
&result);
if (!result) {
startupFailed(m_shellProcess->commandLine());
startupFailed(cmdLine);
}
return result;