Revision: 77070
          http://sourceforge.net/p/brlcad/code/77070
Author:   brlcad
Date:     2020-09-06 06:14:13 +0000 (Sun, 06 Sep 2020)
Log Message:
-----------
don't crash if we can't determine the unit type in the gdal plugin.  still 
can't handle png and bombs out, but at least aborts slightly more gracefully.

Modified Paths:
--------------
    brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp

Modified: brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp
===================================================================
--- brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp       2020-09-06 05:50:07 UTC 
(rev 77069)
+++ brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp       2020-09-06 06:14:13 UTC 
(rev 77070)
@@ -221,7 +221,7 @@
      * the argument to the warping function*/
     GDALDatasetH hOutDS;
     int zone = (state->ops->zone == INT_MAX) ? gdal_utm_zone(state) : 
state->ops->zone;
-    char *dunit;
+    char *dunit = NULL;
     const char *dunit_default = "m";
     struct bu_vls new_proj4_str = BU_VLS_INIT_ZERO;
     if (zone != INT_MAX) {
@@ -236,10 +236,13 @@
         * yet in the form needed by the DSP primitive */
        hOutDS = GDALAutoCreateWarpedVRT(state->hDataset, NULL, dst_Wkt, 
GRA_CubicSpline, 0.0, NULL);
        CPLFree(dst_Wkt);
-       dunit = bu_strdup(GDALGetRasterUnitType(((GDALDataset 
*)hOutDS)->GetRasterBand(1)));
-       bu_log("\nTransformed dataset info:\n");
-       (void)get_dataset_info(hOutDS);
-       gdal_elev_minmax(hOutDS);
+
+       if (hOutDS) {
+           dunit = bu_strdup(GDALGetRasterUnitType(((GDALDataset 
*)hOutDS)->GetRasterBand(1)));
+           bu_log("\nTransformed dataset info:\n");
+           (void)get_dataset_info(hOutDS);
+           gdal_elev_minmax(hOutDS);
+       }
     } else {
        hOutDS = state->hDataset;
        dunit = bu_strdup(GDALGetRasterUnitType(((GDALDataset 
*)hOutDS)->GetRasterBand(1)));

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to