From ed0b78252e318ca04ed79d1e7887a06358f787d9 Mon Sep 17 00:00:00 2001 From: Andrej Babic Date: Thu, 4 Jun 2020 13:19:15 +0200 Subject: [PATCH] Add checks for pulse_id ranges and pulse_id_step --- sf-writer/src/JFH5Writer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sf-writer/src/JFH5Writer.cpp b/sf-writer/src/JFH5Writer.cpp index df46c77..e49161a 100644 --- a/sf-writer/src/JFH5Writer.cpp +++ b/sf-writer/src/JFH5Writer.cpp @@ -84,6 +84,14 @@ size_t JFH5Writer::get_n_pulses_in_range( const uint64_t stop_pulse_id, const int pulse_id_step) { + if (stop_pulse_id < start_pulse_id) { + throw runtime_error("stop_pulse_id smaller than start_pulse_id."); + } + + if (100 % pulse_id_step != 0) { + throw runtime_error("100 is not divisible by the pulse_id step."); + } + size_t n_pulses = 0; if (start_pulse_id % pulse_id_step == 0) { n_pulses++;