diff --git a/app/otbPatchesExtraction.cxx b/app/otbPatchesExtraction.cxx index 7b0ce4565e687da42bdf9adb71cadd883acd56cc..a3da71f3563cb176a146af6f4e6dd8f3d86cf171 100644 --- a/app/otbPatchesExtraction.cxx +++ b/app/otbPatchesExtraction.cxx @@ -220,9 +220,16 @@ public: otbAppLogINFO("Number of samples rejected : " << sampler->GetNumberOfRejectedSamples()); // Save patches image - for (unsigned int i = 0 ; i < m_Bundles.size() ; i++) + if (sampler->GetNumberOfAcceptedSamples()>0) { - SetParameterOutputImage(m_Bundles[i].m_KeyOut, sampler->GetOutputPatchImages()[i]); + for (unsigned int i = 0 ; i < m_Bundles.size() ; i++) + { + SetParameterOutputImage(m_Bundles[i].m_KeyOut, sampler->GetOutputPatchImages()[i]); + } + } + else + { + otbAppLogFATAL("No patch to sample. Please check that your vector data falls inside your images, and no-data values."); }