From 448471a3993d388f5c7edc175726a1b5123d4577 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 9 Dec 2022 11:49:45 +0100 Subject: [PATCH] VcsBase: Ensure context not null inside vcsExecWithHandler() When passed context is null use VcsBaseClientImpl as a context. Amends 287a7c92689628bb05c8ca4a26289b49d8440a05 Change-Id: I5817d74207683ae000fc2662920af2d1ff23d5ea Reviewed-by: Orgad Shaneh --- src/plugins/vcsbase/vcsbaseclient.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp index 1d0e4b2cc9e..b1b5aad07c6 100644 --- a/src/plugins/vcsbase/vcsbaseclient.cpp +++ b/src/plugins/vcsbase/vcsbaseclient.cpp @@ -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)); }); }