# HG changeset patch # User Chris Cannam # Date 1538401031 -3600 # Node ID b89705af7a609fbac4ab8df394594f41ac3e3180 # Parent a7485c1bdba51c5eaa2483f610fad8056a897e0a Use an actual exception for this (rather than checking only in some builds) diff -r a7485c1bdba5 -r b89705af7a60 base/RangeMapper.cpp --- a/base/RangeMapper.cpp Tue Sep 18 15:04:46 2018 +0100 +++ b/base/RangeMapper.cpp Mon Oct 01 14:37:11 2018 +0100 @@ -20,6 +20,7 @@ #include #include +#include LinearRangeMapper::LinearRangeMapper(int minpos, int maxpos, double minval, double maxval, @@ -33,8 +34,12 @@ m_inverted(inverted), m_labels(labels) { - assert(m_maxval != m_minval); - assert(m_maxpos != m_minpos); + if (m_maxval == m_minval) { + throw std::logic_error("LinearRangeMapper: maxval must differ from minval"); + } + if (m_maxpos == m_minpos) { + throw std::logic_error("LinearRangeMapper: maxpos must differ from minpos"); + } } int @@ -101,7 +106,9 @@ // << maxval << ", minlog " << m_minlog << ", ratio " << m_ratio // << ", unit " << unit << endl; - assert(m_maxpos != m_minpos); + if (m_maxpos == m_minpos) { + throw std::logic_error("LogRangeMapper: maxpos must differ from minpos"); + } m_maxlog = (m_maxpos - m_minpos) / m_ratio + m_minlog;