[GRASS-dev] r.out.gdal segfault in XY location

Martin Landa landa.martin at gmail.com
Sun Nov 5 05:03:20 EST 2006


Hi,

I just realize that r.out.gdal2 crashes with segmentation fault in XY
(unprojected) location. If there is no objections I will fix it in CVS
(see the patch).

Best, Martin

-- 
Martin Landa <landa.martin at gmail.com> * http://gama.fsv.cvut.cz/~landa *
-------------- next part --------------
Index: main.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/raster/r.out.gdal/main.c,v
retrieving revision 1.3
diff -u -r1.3 main.c
--- main.c	4 Nov 2006 23:10:14 -0000	1.3
+++ main.c	5 Nov 2006 09:59:16 -0000
@@ -333,10 +333,14 @@
 	adfGeoTransform[3] = cellhead.north;
 	adfGeoTransform[4] = 0.0;
 	adfGeoTransform[5] = -1*cellhead.ns_res;
-	if ( GDALSetGeoTransform( hCurrDS, adfGeoTransform ) >=CE_Failure) G_warning(_("Couldn't set geo transform ...\n"));
+	if ( GDALSetGeoTransform( hCurrDS, adfGeoTransform ) >=CE_Failure) G_warning(_("Couldn't set geo transform."));
 
 	/* Set Projection  */
-	if ( GDALSetProjection( hCurrDS, srswkt ) >=CE_Failure) G_warning(_("Couldn't set projection ...\n"));
+	CPLErr ret;
+	if (srswkt)
+		ret = GDALSetProjection( hCurrDS, srswkt );
+	if (!srswkt || ret == CE_Failure)
+		G_warning(_("Couldn't set projection."));
 
 	/* Add metadata */
 	AttachMetadata( hCurrDS, metaopt->answers );


More information about the grass-dev mailing list