Skip to content

Commit

Permalink
v.surf.idw: fix uninitialized ret value for 2D without column specifi…
Browse files Browse the repository at this point in the history
…ed (#1541)

In cases of 2D points and no column specified, uninitialized value caused sometimes bogus warning and skipping points
  • Loading branch information
petrasovaa committed Apr 21, 2021
1 parent 4626dc4 commit a51da56
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions vector/v.surf.idw/read_sites.c
Expand Up @@ -86,30 +86,31 @@ void read_sites(const char *name, const char *field_name, const char *col,
continue;

if (!with_z) {
int cat, ival, ret;
int cat;

/* TODO: what to do with multiple cats */
Vect_cat_get(Cats, field, &cat);
if (cat < 0) /* skip features without category */
continue;

if (col) {
int ival, ret;

if (ctype == DB_C_TYPE_INT) {
ret = db_CatValArray_get_value_int(&cvarr, cat, &ival);
dval = ival;
}
else { /* DB_C_TYPE_DOUBLE */
ret = db_CatValArray_get_value_double(&cvarr, cat, &dval);
}
if (ret != DB_OK) {
G_warning(_("No record for point (cat = %d)"), cat);
continue;
}
}
else {
dval = cat;
}

if (ret != DB_OK) {
G_warning(_("No record for point (cat = %d)"), cat);
continue;
}
}
else
dval = Points->z[0];
Expand Down

0 comments on commit a51da56

Please sign in to comment.