From e86ea302dca326a682913275018de42cc9b6fa70 Mon Sep 17 00:00:00 2001
From: Otmane Lahlou <otmane.lahlou@c-s.fr>
Date: Thu, 15 Jan 2009 14:59:27 +0100
Subject: [PATCH] ENH: verifying number of inputs in otbImageToPointSetFilter

---
 Code/BasicFilters/otbImageToPointSetFilter.txx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Code/BasicFilters/otbImageToPointSetFilter.txx b/Code/BasicFilters/otbImageToPointSetFilter.txx
index 066d3d6965..ab22fa25c7 100644
--- a/Code/BasicFilters/otbImageToPointSetFilter.txx
+++ b/Code/BasicFilters/otbImageToPointSetFilter.txx
@@ -87,6 +87,7 @@ const typename ImageToPointSetFilter<TInputImage,TOutputPointSet>::InputImageTyp
 ImageToPointSetFilter<TInputImage,TOutputPointSet>
 ::GetInput(unsigned int idx)
 {
+    
   return dynamic_cast<const InputImageType*>
     (this->ProcessObjectType::GetInput(idx));
 }
@@ -97,8 +98,11 @@ ImageToPointSetFilter<TInputImage,TOutputPointSet>
 template <class TInputImage, class TOutputPointSet>
 const typename ImageToPointSetFilter<TInputImage,TOutputPointSet>::InputImageType *
 ImageToPointSetFilter<TInputImage,TOutputPointSet>
-::GetInput()
+::GetInput(void)
 {
+  if(this->GetNumberOfInputs() < 1)
+    return 0;
+  
   return dynamic_cast<const InputImageType*>
     (this->ProcessObjectType::GetInput(0));
 }
-- 
GitLab