diff --git a/Code/IO/otbImageFileReader.txx b/Code/IO/otbImageFileReader.txx
index 2ae3d82078af46397d8a79c669804b079066d287..1746b40b243d90a3eacc41a8d18c70b1755c16c2 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