X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=blobdiff_plain;f=src%2Fdata%2Fvariable.c;h=87e7d07823f42271707000938d7501a24f562250;hp=2e584fe86fa5dd7e9867c27d257186e3ecd4a528;hb=c6caca37f19989f96ad843e2baee09a54c4f23ba;hpb=c1b1583b96cc05a2bf9f3f6d01bbfa063fafb253 diff --git a/src/data/variable.c b/src/data/variable.c index 2e584fe86f..87e7d07823 100644 --- a/src/data/variable.c +++ b/src/data/variable.c @@ -1357,15 +1357,16 @@ var_clear_vardict (struct variable *v) double var_force_valid_weight (const struct variable *wv, double w, bool *warn_on_invalid) { - if (w < 0.0 || (wv && var_is_num_missing (wv, w))) - w = 0.0; - - if (w == 0.0 && warn_on_invalid != NULL && *warn_on_invalid) + if (w <= 0.0 || (wv ? var_is_num_missing (wv, w) : w == SYSMIS)) { - *warn_on_invalid = false; - msg (SW, _("At least one case in the data file had a weight value " - "that was user-missing, system-missing, zero, or " - "negative. These case(s) were ignored.")); + w = 0.0; + if (warn_on_invalid != NULL && *warn_on_invalid) + { + *warn_on_invalid = false; + msg (SW, _("At least one case in the data file had a weight value " + "that was user-missing, system-missing, zero, or " + "negative. These case(s) were ignored.")); + } } return w;