From 6fab6257ab721a28b836417f591785bc7f5cf779 Mon Sep 17 00:00:00 2001
From: Cyrille Valladeau <cyrille.valladeau@c-s.fr>
Date: Tue, 22 Jun 2010 20:36:33 +0200
Subject: [PATCH] ENH : add a IsNull for setDepth over imageIO

---
 Code/IO/otbImageFileReader.txx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Code/IO/otbImageFileReader.txx b/Code/IO/otbImageFileReader.txx
index 2ae3d82078..1746b40b24 100644
--- a/Code/IO/otbImageFileReader.txx
+++ b/Code/IO/otbImageFileReader.txx
@@ -391,7 +391,10 @@ ImageFileReader<TOutputImage>
           //we need to pass the depth information which in on the IO to the projection
           //to be handle throught the kwl
           typename TileMapImageIO::Pointer imageIO = dynamic_cast<TileMapImageIO*>(this->GetImageIO());
-          dynamic_cast<ossimTileMapModel*>(projection)->setDepth(imageIO->GetDepth());
+	  if(imageIO.IsNotNull())
+	    {
+	      dynamic_cast<ossimTileMapModel*>(projection)->setDepth(imageIO->GetDepth());
+	    }
           }
         hasMetaData = projection->saveState(geom_kwl);
 //             delete projection; //FIXME find out where this should occur
-- 
GitLab