From: John Darrington Date: Tue, 2 Jun 2015 08:26:06 +0000 (+0200) Subject: Fixed bug GRAPH /HISTOGRAM vs. null data. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab0f16ff4bf644918474042c4f6b0ae7b71aeb78;p=pspp Fixed bug GRAPH /HISTOGRAM vs. null data. Fixed a crash which occured when GRAPH /HISTOGRAM was called on a dataset with less than 2 data.' --- diff --git a/src/language/stats/graph.c b/src/language/stats/graph.c index ae80616862..b695f4c94a 100644 --- a/src/language/stats/graph.c +++ b/src/language/stats/graph.c @@ -189,6 +189,11 @@ show_histogr (const struct graph *cmd, struct casereader *input) histogram_create (bin_width, cmd->es[0].minimum, cmd->es[0].maximum); } + if (NULL == histogram) + { + casereader_destroy (input); + return; + } for (;(c = casereader_read (input)) != NULL; case_unref (c)) { diff --git a/tests/language/stats/graph.at b/tests/language/stats/graph.at index f4b125b24e..ae716a3b8d 100644 --- a/tests/language/stats/graph.at +++ b/tests/language/stats/graph.at @@ -147,3 +147,19 @@ dnl Ignore output -- this is just a no-crash check. AT_CLEANUP +AT_SETUP([GRAPH histogram with null data]) +AT_DATA([null-hist.sps], [dnl +data list list /x *. +begin data. +1109 +. +end data. + +graph + /histogram = x. + +]) + +AT_CHECK([pspp -o pspp.pdf null-hist.sps], [0], [ignore]) +dnl Ignore output -- this is just a no-crash check. +AT_CLEANUP