[GRASS-SVN] r35855 - grass/trunk/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Feb 11 13:28:00 EST 2009


Author: martinl
Date: 2009-02-11 13:28:00 -0500 (Wed, 11 Feb 2009)
New Revision: 35855

Modified:
   grass/trunk/lib/gis/key_value1.c
Log:
libgis: avoid segfault if Key_Value is NULL (related to trac #492)


Modified: grass/trunk/lib/gis/key_value1.c
===================================================================
--- grass/trunk/lib/gis/key_value1.c	2009-02-11 18:15:20 UTC (rev 35854)
+++ grass/trunk/lib/gis/key_value1.c	2009-02-11 18:28:00 UTC (rev 35855)
@@ -129,9 +129,13 @@
 {
     int n;
 
+    if (!kv)
+	return NULL;
+    
     for (n = 0; n < kv->nitems; n++)
 	if (strcmp(key, kv->key[n]) == 0)
 	    return kv->value[n][0] ? kv->value[n] : NULL;
+    
     return NULL;
 }
 



More information about the grass-commit mailing list