From ea7f4e8defbca50342a51d2f9864ec4a98de25b4 Mon Sep 17 00:00:00 2001 From: jistone Date: Wed, 18 Jan 2006 02:06:19 +0000 Subject: 2006-01-17 Josh Stone PR 2156 * translate.cxx (c_unparser::visit_foreach_loop): Check the return value of _stp_pmap_agg() for NULL. --- translate.cxx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'translate.cxx') diff --git a/translate.cxx b/translate.cxx index 01179e2f..ba383682 100644 --- a/translate.cxx +++ b/translate.cxx @@ -2021,11 +2021,17 @@ c_unparser::visit_foreach_loop (foreach_loop *s) if (mv.is_parallel()) { varlock_w agg_and_maybe_sort_guard(*this, mv); - o->newline() << mv.calculate_aggregate() << ";"; + o->newline() << "if (unlikely(NULL == " << mv.calculate_aggregate() << "))"; + o->newline(1) << "c->last_error = \"unknown error while aggregating " << mv << "\";"; + o->indent(-1); + // sort array if desired - if (s->sort_direction) - o->newline() << "_stp_map_sort (" << mv.fetch_existing_aggregate() << ", " - << s->sort_column << ", " << - s->sort_direction << ");"; + if (s->sort_direction) { + o->newline() << "else"; // only sort if aggregation was ok + o->newline(1) << "_stp_map_sort (" << mv.fetch_existing_aggregate() << ", " + << s->sort_column << ", " << - s->sort_direction << ");"; + o->indent(-1); + } } else { -- cgit