X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fcharts%2Fboxplot.c;h=0abb971f44a28909cf7939c3b78b2dc57ede2937;hb=f81e16108f3becda7dc7858f181f559f7ae96401;hp=deabc1fa6e8f059c026c5c079b6e4a60f43b0b5a;hpb=81579d9e9f994fb2908f50af41c3eb033d216e58;p=pspp diff --git a/src/output/charts/boxplot.c b/src/output/charts/boxplot.c index deabc1fa6e..0abb971f44 100644 --- a/src/output/charts/boxplot.c +++ b/src/output/charts/boxplot.c @@ -25,6 +25,8 @@ struct boxplot * boxplot_create (double y_min, double y_max, const char *title) { + if (y_min >= y_max) + return NULL; struct boxplot *boxplot = xmalloc (sizeof *boxplot); chart_item_init (&boxplot->chart_item, &boxplot_class, title); boxplot->y_min = y_min; @@ -38,6 +40,13 @@ void boxplot_add_box (struct boxplot *boxplot, struct box_whisker *bw, const char *label) { + if (boxplot == NULL) + { + struct statistic *statistic = &bw->parent.parent; + statistic->destroy (statistic); + return; + } + struct boxplot_box *box; if (boxplot->n_boxes >= boxplot->boxes_allocated) boxplot->boxes = x2nrealloc (boxplot->boxes, &boxplot->boxes_allocated, @@ -51,6 +60,9 @@ static void boxplot_chart_destroy (struct chart_item *chart_item) { struct boxplot *boxplot = to_boxplot (chart_item); + if (boxplot == NULL) + return; + size_t i; for (i = 0; i < boxplot->n_boxes; i++)