[GRASS-SVN] r31624 - grass/branches/develbranch_6/visualization/nviz/src

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jun 4 05:22:04 EDT 2008


Author: martinl
Date: 2008-06-04 05:22:04 -0400 (Wed, 04 Jun 2008)
New Revision: 31624

Modified:
   grass/branches/develbranch_6/visualization/nviz/src/map_obj.c
   grass/branches/develbranch_6/visualization/nviz/src/nviz_init.c
Log:
nviz: avoid crashing on elevation map not found


Modified: grass/branches/develbranch_6/visualization/nviz/src/map_obj.c
===================================================================
--- grass/branches/develbranch_6/visualization/nviz/src/map_obj.c	2008-06-04 07:01:13 UTC (rev 31623)
+++ grass/branches/develbranch_6/visualization/nviz/src/map_obj.c	2008-06-04 09:22:04 UTC (rev 31624)
@@ -471,7 +471,10 @@
     arglist[2] = topo_string;
     if ((argc >= 3) && (strncmp(argv[2], "name=", 5))) {
         arglist[3] = argv[2];
-        set_att(new_id, SURF, data, interp, 3, arglist);
+        if (set_att(new_id, SURF, data, interp, 3, arglist) != TCL_OK) {
+	    GS_delete_surface(new_id);
+	    return (TCL_ERROR);
+	}
         file_used = 1;
     }
     else {
@@ -1749,6 +1752,9 @@
 
 	    G_debug(3, "Loading attribute map %s\n", argv[3]);
 	    ret = GS_load_att_map(id, argv[3], att);
+	    if (ret < 0) {
+		return TCL_ERROR;
+	    }
     }
 
     /* After we've loaded a constant map or a file,

Modified: grass/branches/develbranch_6/visualization/nviz/src/nviz_init.c
===================================================================
--- grass/branches/develbranch_6/visualization/nviz/src/nviz_init.c	2008-06-04 07:01:13 UTC (rev 31623)
+++ grass/branches/develbranch_6/visualization/nviz/src/nviz_init.c	2008-06-04 09:22:04 UTC (rev 31624)
@@ -288,8 +288,12 @@
 	for (i = 0; elev->answers[i]; i++) {
 	    arglist[1] = "surf";
 	    arglist[2] = elev->answers[i];
-	    Nnew_map_obj_cmd(data, interp, 3, arglist);
 
+	    if (Nnew_map_obj_cmd(data, interp, 3, arglist) != TCL_OK) {
+		G_warning(_("Loading data failed"));
+		continue;
+	    }
+
 	    /* See if we should autoload the color file */
 	    if (aload) {
 		strncpy(tmp, interp->result, 29);



More information about the grass-commit mailing list