From d39cc9ca9940873c667947fb38ef27257fe93f45 Mon Sep 17 00:00:00 2001
From: Ben Cumming <louncharf@gmail.com>
Date: Wed, 8 Nov 2017 12:42:19 +0100
Subject: [PATCH] Set a default binning policy in mc_cell_group (#384)

Fixes #383 (segfault owing to empty vector of binners).

* Add call to `set_binning_policy` in `mc_cell_group` constructor with default `binning_kind::none` policy.
---
 src/mc_cell_group.hpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mc_cell_group.hpp b/src/mc_cell_group.hpp
index fde81297..845e9b3d 100644
--- a/src/mc_cell_group.hpp
+++ b/src/mc_cell_group.hpp
@@ -40,6 +40,9 @@ public:
     mc_cell_group(std::vector<cell_gid_type> gids, const recipe& rec):
         gids_(std::move(gids))
     {
+        // Default to no binning of events
+        set_binning_policy(binning_kind::none, 0);
+
         // Build lookup table for gid to local index.
         for (auto i: util::make_span(0, gids_.size())) {
             gid_index_map_[gids_[i]] = i;
-- 
GitLab