+2006-01-17 Josh Stone <joshua.i.stone@intel.com>
+
+ PR 2156
+ * translate.cxx (c_unparser::visit_foreach_loop): Check the return
+ value of _stp_pmap_agg() for NULL.
+
2006-01-17 Frank Ch. Eigler <fche@elastic.org>
* systemtap.spec.in: Remove explicit kernel-devel dependency,
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
{