From 805e5dca134be601f3d0efe4765c96b330d2e1e9 Mon Sep 17 00:00:00 2001
From: Emmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org>
Date: Mon, 9 Nov 2009 16:56:53 +0800
Subject: [PATCH] BUG: fix segfault after ossim update

---
 Testing/Utilities/ossimRadarSatSupport.cxx | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/Testing/Utilities/ossimRadarSatSupport.cxx b/Testing/Utilities/ossimRadarSatSupport.cxx
index 6573d25ff9..dabc6dbdd7 100644
--- a/Testing/Utilities/ossimRadarSatSupport.cxx
+++ b/Testing/Utilities/ossimRadarSatSupport.cxx
@@ -79,10 +79,19 @@ int ossimRadarSatSupport( int argc, char* argv[] )
 		 */
         ossimKeywordlist geom;
         std::cout<<"Read ossim Keywordlist...";
-		  if  (! handler->getImageGeometry()->getProjection()->saveState(geom)) {
-				std::cout << "Bad metadata parsing "<< std::endl;
-				return EXIT_FAILURE;
-		  }
+
+        bool hasMetaData = false;
+        ossimProjection* projection = handler->getImageGeometry()->getProjection();
+
+        if (projection)
+        {
+          hasMetaData = projection->saveState(geom);
+        }
+
+        if  (! hasMetaData) {
+                      std::cout << "Bad metadata parsing "<< std::endl;
+                      return EXIT_FAILURE;
+        }
 
         ossimGpt ossimGPoint(0,0);
         ossimDpt ossimDPoint;
-- 
GitLab