VcsBase: Ensure context not null inside vcsExecWithHandler()

When passed context is null use VcsBaseClientImpl as a context.

Amends 287a7c9268

Change-Id: I5817d74207683ae000fc2662920af2d1ff23d5ea
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2022-12-09 11:49:45 +01:00
parent c0f3ef9a82
commit 448471a399

View File

@@ -170,7 +170,8 @@ void VcsBaseClientImpl::vcsExecWithHandler(const FilePath &workingDirectory,
command->addFlags(additionalFlags);
command->addJob({vcsBinary(), arguments}, vcsTimeoutS());
if (handler) {
connect(command, &VcsCommand::done, context, [command, handler] {
const QObject *actualContext = context ? context : this;
connect(command, &VcsCommand::done, actualContext, [command, handler] {
handler(CommandResult(*command));
});
}