[GRASS-SVN] r38629 - grass/trunk/lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Aug 6 11:25:43 EDT 2009
Author: glynn
Date: 2009-08-06 11:25:42 -0400 (Thu, 06 Aug 2009)
New Revision: 38629
Modified:
grass/trunk/lib/gis/parser.c
Log:
Check option types
Modified: grass/trunk/lib/gis/parser.c
===================================================================
--- grass/trunk/lib/gis/parser.c 2009-08-06 12:55:29 UTC (rev 38628)
+++ grass/trunk/lib/gis/parser.c 2009-08-06 15:25:42 UTC (rev 38629)
@@ -2086,7 +2086,7 @@
while (opt != NULL) {
/* Check answer against options if any */
- if (opt->options && opt->answer) {
+ if (opt->answer) {
if (opt->multiple == 0)
error += check_an_opt(opt->key, opt->type,
opt->options, opt->opts, &opt->answer);
@@ -2166,6 +2166,9 @@
if (sscanf(ans, "%d", &d) != 1)
return MISSING_VALUE;
+ if (!opts)
+ return 0;
+
for (i = 0; opts[i]; i++) {
const char *opt = opts[i];
int lo, hi;
@@ -2207,6 +2210,9 @@
if (sscanf(ans, "%lf", &d) != 1)
return MISSING_VALUE;
+ if (!opts)
+ return 0;
+
for (i = 0; opts[i]; i++) {
const char *opt = opts[i];
double lo, hi;
@@ -2246,6 +2252,9 @@
int found = 0;
int i;
+ if (!opts)
+ return 0;
+
for (i = 0; opts[i]; i++) {
if (strcmp(ans, opts[i]) == 0)
return 0;
More information about the grass-commit
mailing list