From 5c8b2d86d983c27865190d10265c9e65e3125aa6 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Fri, 27 Dec 2024 10:29:28 -0500 Subject: [PATCH] BUG: move null check to *before* dereferencing cppcheck warned: nullPointerRedundantCheck,itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx:67,warning,Either the condition '!input' is redundant or there is possible null pointer dereference: input. There is a slight behaviour change now: `m_NumberOfTimePoints` is no longer set if `input` is provided and `output` is not. --- .../itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx b/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx index 7b90bbee857..8432264d3ec 100644 --- a/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx +++ b/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx @@ -64,11 +64,11 @@ TimeVaryingVelocityFieldIntegrationImageFilterGetInput(); DisplacementFieldType * output = this->GetOutput(); - this->m_NumberOfTimePoints = input->GetLargestPossibleRegion().GetSize()[OutputImageDimension]; if (!input || !output) { return; } + this->m_NumberOfTimePoints = input->GetLargestPossibleRegion().GetSize()[OutputImageDimension]; // // The ImageBase::CopyInformation() method ca not be used here