From: Ben Pfaff Date: Mon, 20 Jul 2009 00:11:46 +0000 (-0700) Subject: charts: Allow passing a null pointer to chart_unref. X-Git-Tag: v0.7.3~7 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5278a229f3fce7a8d1f2d8f6b576d1c8b76f3779;p=pspp-builds.git charts: Allow passing a null pointer to chart_unref. --- diff --git a/src/output/chart.c b/src/output/chart.c index b096a7d2..b1f96ef9 100644 --- a/src/output/chart.c +++ b/src/output/chart.c @@ -114,9 +114,12 @@ chart_ref (const struct chart *chart_) void chart_unref (struct chart *chart) { - assert (chart->ref_cnt > 0); - if (--chart->ref_cnt == 0) - chart->class->destroy (chart); + if (chart != NULL) + { + assert (chart->ref_cnt > 0); + if (--chart->ref_cnt == 0) + chart->class->destroy (chart); + } } void