Skip to content

Commit 7797940

Browse files
Check that calling pineappl_grid_subgrid_array on an empty subgrid does not panic
1 parent a02beae commit 7797940

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

examples/cpp/advanced-filling.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <iomanip>
77
#include <memory>
88
#include <vector>
9+
#include <numeric>
910

1011
int main() {
1112
// Construct the channel object based on the nb of convolutions
@@ -165,6 +166,10 @@ int main() {
165166
pineappl_grid_subgrid_shape(grid, 0, 0, 0, subgrid_shape.data());
166167
assert(subgrid_shape == zero_vector);
167168

169+
// Check that a call to an empty subgrid does not panic
170+
std::vector<double> subgrid_array(0);
171+
pineappl_grid_subgrid_array(grid, 0, 0, 0, subgrid_array.data());
172+
168173
pineappl_grid_write(grid, "advanced-filling.pineappl.lz4");
169174

170175
// release memory

0 commit comments

Comments
 (0)