diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-08-04 11:37:39 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-08-04 11:38:46 +0200 |
commit | a2483a839264369482fff135d33f007ded266d3c (patch) | |
tree | 8303ce11ccdb32dc6a313a54dd20678739e12ac0 /src/events_ds.h | |
parent | d76db6f000844cac0afdff87e21abdf4ec009f07 (diff) |
Fix crash when loading a kit with more channels than the engine was compiled for.
Diffstat (limited to 'src/events_ds.h')
-rw-r--r-- | src/events_ds.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/events_ds.h b/src/events_ds.h index fdab881..41287d1 100644 --- a/src/events_ds.h +++ b/src/events_ds.h @@ -149,6 +149,8 @@ private: template <typename T, typename... Args> T& EventsDS::emplace(channel_t ch, Args&&... args) { + assert(ch < NUM_CHANNELS); + // add new event types here static_assert(std::is_same<T, SampleEvent>::value, "Check event type"); @@ -180,6 +182,8 @@ T& EventsDS::get(EventID event_id) template <typename T> ContainerRange<std::vector<T>> EventsDS::iterateOver(channel_t ch) { + assert(ch < NUM_CHANNELS); + // add new event types here static_assert(std::is_same<T, SampleEvent>::value, "Check event type"); @@ -193,6 +197,8 @@ ContainerRange<std::vector<T>> EventsDS::iterateOver(channel_t ch) template <typename T> T& EventsDS::getSample(EventInfo const& info) { + assert(info.ch < NUM_CHANNELS); + // add new event types here static_assert(std::is_same<T, SampleEvent>::value, "Check event type"); |