From: John Darrington Date: Sat, 4 Jul 2020 06:38:33 +0000 (+0200) Subject: Follow-up to bugfix #58664 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=033725a375c3ffe41c3e6025e8c65962bf726062;p=pspp Follow-up to bugfix #58664 If the width of a variable changes, then implicitly so does its missing values --- even if the number of missing values is zero. This is because the variable's width is cached in the missing_value struct itself. --- diff --git a/src/data/variable.c b/src/data/variable.c index 2b0dd2579d..593e23ca72 100644 --- a/src/data/variable.c +++ b/src/data/variable.c @@ -307,17 +307,15 @@ var_set_width_and_formats (struct variable *v, int new_width, ov = var_clone (v); - if (var_has_missing_values (v)) + if (mv_is_resizable (&v->miss, new_width)) + mv_resize (&v->miss, new_width); + else { - if (mv_is_resizable (&v->miss, new_width)) - mv_resize (&v->miss, new_width); - else - { - mv_destroy (&v->miss); - mv_init (&v->miss, new_width); - } - traits |= VAR_TRAIT_MISSING_VALUES; + mv_destroy (&v->miss); + mv_init (&v->miss, new_width); } + if (new_width != var_get_width (v)) + traits |= VAR_TRAIT_MISSING_VALUES; if (v->val_labs != NULL) {