glm.c: new function design_full to create default interactions
[pspp-builds.git] / src / math / interaction.c
index afdc3277754884a69fe83b090c2c380321d55935..d24166d4379b18bf7e7b84c976b6cd4ad2aa4ad8 100644 (file)
@@ -48,8 +48,12 @@ interaction_create (const struct variable *v)
 {
   struct interaction  *i = xmalloc (sizeof *i);
   i->vars = xmalloc (sizeof *i->vars);
-  i->vars[0] = v;
-  i->n_vars = 1;
+  i->n_vars = 0;
+  if ( v )
+    {
+      i->vars[0] = v;
+      i->n_vars = 1;
+    }
   return i;
 }