X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmath%2Finteraction.c;h=a36755b541265fbc3da3e1ca8fcc465ec0ea120e;hb=3d48d485cb9eca0283aa5f910c86e86a73242490;hp=4e4134f0ffcceb0b1ac79b5a8e0b583a3924be41;hpb=75e7e4241ba2424c3803548bcf2da0382faf7349;p=pspp diff --git a/src/math/interaction.c b/src/math/interaction.c index 4e4134f0ff..a36755b541 100644 --- a/src/math/interaction.c +++ b/src/math/interaction.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2011 Free Software Foundation, Inc. + Copyright (C) 2011, 2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -146,11 +146,14 @@ void interaction_dump (const struct interaction *i) { int v = 0; - printf ("%s", var_get_name (i->vars[v])); - for (v = 1; v < i->n_vars; ++v) + if ( i->n_vars == 0) { - printf (" * %s", var_get_name (i->vars[v])); + printf ("(empty)\n"); + return; } + printf ("%s", var_get_name (i->vars[v])); + for (v = 1; v < i->n_vars; ++v) + printf (" * %s", var_get_name (i->vars[v])); printf ("\n"); } @@ -163,6 +166,8 @@ void interaction_to_string (const struct interaction *iact, struct string *str) { int v = 0; + if ( iact->n_vars == 0) + return; ds_put_cstr (str, var_to_string (iact->vars[v])); for (v = 1; v < iact->n_vars; ++v) {