Skip to content

Commit

Permalink
v.random: Fix segfault as per bug #1024 (#1025)
Browse files Browse the repository at this point in the history
cats_array memory is allocated only when fields for parm.input->answer are > 0

Co-authored-by: Māris Nartišs <maris.nartiss@lu.lv>
  • Loading branch information
marisn and Māris Nartišs committed Oct 26, 2020
1 parent 12c0bba commit c3ad638
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vector/v.random/main.c
Expand Up @@ -667,7 +667,7 @@ int main(int argc, char *argv[])
cat = i + 1;

if (!notable) {
if (parm.input->answer) {
if (parm.input->answer && field > 0) {
Vect_cat_get(Cats, field, &cat_area);

cats_array[i].cat = cat;
Expand Down

0 comments on commit c3ad638

Please sign in to comment.