diff --git a/src/Processors/Executors/PullingAsyncPipelineExecutor.cpp b/src/Processors/Executors/PullingAsyncPipelineExecutor.cpp index 5799fbcc5d8..3dc99397bd1 100644 --- a/src/Processors/Executors/PullingAsyncPipelineExecutor.cpp +++ b/src/Processors/Executors/PullingAsyncPipelineExecutor.cpp @@ -175,20 +175,22 @@ bool PullingAsyncPipelineExecutor::pull(Block & block, uint64_t milliseconds) void PullingAsyncPipelineExecutor::cancel() { + if (!data) + return; + /// Cancel execution if it wasn't finished. - if (data && !data->is_finished && data->executor) + if (!data->is_finished && data->executor) data->executor->cancel(); /// The following code is needed to rethrow exception from PipelineExecutor. /// It could have been thrown from pull(), but we will not likely call it again. /// Join thread here to wait for possible exception. - if (data && data->thread.joinable()) + if (data->thread.joinable()) data->thread.join(); /// Rethrow exception to not swallow it in destructor. - if (data) - data->rethrowExceptionIfHas(); + data->rethrowExceptionIfHas(); } Chunk PullingAsyncPipelineExecutor::getTotals()