From 83a99880a894adec247211b5484d8c3418422123 Mon Sep 17 00:00:00 2001 From: Guillaume Pasero <guillaume.pasero@c-s.fr> Date: Wed, 30 Sep 2015 16:48:04 +0200 Subject: [PATCH] COV: fix coverity defect REVERSE_INULL --- .../include/otbNeuralNetworkMachineLearningModel.txx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.txx index 87eed252e0..b76e6dd70d 100644 --- a/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.txx +++ b/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.txx @@ -73,10 +73,14 @@ template<class TInputValue, class TOutputValue> void NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::LabelsToMat(const TargetListSampleType * labels, cv::Mat & output) { - unsigned int nbSamples = labels->Size(); + unsigned int nbSamples = 0; + if (labels != NULL) + { + nbSamples = labels->Size(); + } // Check for valid listSample - if (labels != NULL && nbSamples > 0) + if (nbSamples > 0) { // Build an iterator typename TargetListSampleType::ConstIterator labelSampleIt = labels->Begin(); -- GitLab