changeset 1642:d591836e47ef single-point

Fix compiler warning
author Chris Cannam
date Wed, 13 Mar 2019 14:46:54 +0000
parents 751a52865270
children 7a23dfe65d66
files base/EventSeries.cpp
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/base/EventSeries.cpp	Wed Mar 13 14:46:40 2019 +0000
+++ b/base/EventSeries.cpp	Wed Mar 13 14:46:54 2019 +0000
@@ -408,7 +408,9 @@
 EventSeries::getIndexForEvent(const Event &e) const
 {
     auto pitr = lower_bound(m_events.begin(), m_events.end(), e);
-    return distance(m_events.begin(), pitr);
+    auto d = distance(m_events.begin(), pitr);
+    if (d < 0 || d > INT_MAX) return 0;
+    return int(d);
 }
 
 void