diff --git a/app/otbClassificationMapMosaic.cxx b/app/otbClassificationMapMosaic.cxx
index 4f286cd261628c832ffe2e4469ab071f0854a4fe..8d12c3913ce62521f9ee7c1d85259bc2117f6bd9 100644
--- a/app/otbClassificationMapMosaic.cxx
+++ b/app/otbClassificationMapMosaic.cxx
@@ -140,7 +140,7 @@ public:
       // Set nodata
       FloatVectorImageType::PixelType nodatapix;
       m_ArgmaxMosaicFilter->UpdateOutputInformation();
-      nodatapix.SetSize(filter->GetOutput()->GetNumberOfComponentsPerPixel());
+      nodatapix.SetSize(m_ArgmaxMosaicFilter->GetOutput()->GetNumberOfComponentsPerPixel());
       nodatapix.Fill(GetParameterFloat("nodata"));
       m_ArgmaxMosaicFilter->SetNoDataInputPixel(nodatapix);
       m_ArgmaxMosaicFilter->SetNoDataOutputPixel(nodatapix);