diff base/EventSeries.cpp @ 1642:d591836e47ef single-point

Fix compiler warning
author Chris Cannam
date Wed, 13 Mar 2019 14:46:54 +0000
parents e7f557789f99
children 513192aa9b03
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