[GRASS-SVN] r67132 - grass/trunk/vector/v.out.lidar

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Dec 14 13:06:41 PST 2015


Author: wenzeslaus
Date: 2015-12-14 13:06:41 -0800 (Mon, 14 Dec 2015)
New Revision: 67132

Modified:
   grass/trunk/vector/v.out.lidar/main.c
Log:
v.out.lidar: handle the error state of potential caller error

This fixes Coverity CID 1341810 if it understands G_fatal_error.


Modified: grass/trunk/vector/v.out.lidar/main.c
===================================================================
--- grass/trunk/vector/v.out.lidar/main.c	2015-12-14 20:49:57 UTC (rev 67131)
+++ grass/trunk/vector/v.out.lidar/main.c	2015-12-14 21:06:41 UTC (rev 67132)
@@ -176,6 +176,7 @@
 /*! Get integer value in a column for a category
  *
  * Floating point numbers are casted to integers.
+ * If the column is not numerical, fatal error is issued.
  *
  * \returns The value of the column as an integer
  */
@@ -190,13 +191,16 @@
     if (catval->isNull) {
         G_fatal_error(_("NULL value for cat = %d"), cat);
     }
+
     if (column_values->ctype == DB_C_TYPE_INT) {
         val = catval->val.i;
     }
     else if (column_values->ctype == DB_C_TYPE_DOUBLE) {
         val = catval->val.d;
+    } else {
+        G_fatal_error(_("Column type is not numeric (type = %d, cat = %d"),
+            column_values->ctype, cat);
     }
-    /* else should be checked by caller */
     return val;
 }
 



More information about the grass-commit mailing list