# HG changeset patch # User Chris Cannam # Date 1541511347 0 # Node ID f08a3b8cdb9d76434c0b0d4f182f274cb2a33081 # Parent d18ca558049eff0f253add17dcbc923c44b72daf Avoid nan/inf values (and consequent crash) in colour scale range diff -r d18ca558049e -r f08a3b8cdb9d layer/Colour3DPlotLayer.cpp --- a/layer/Colour3DPlotLayer.cpp Tue Nov 06 13:34:56 2018 +0000 +++ b/layer/Colour3DPlotLayer.cpp Tue Nov 06 13:35:47 2018 +0000 @@ -1049,9 +1049,16 @@ << " (model min = " << m_model->getMinimumLevel() << ", max = " << m_model->getMaximumLevel() << ")" << endl; - + if (maxValue <= minValue) { maxValue = minValue + 0.1f; + + if (!(maxValue > minValue)) { // one of them must be NaN or Inf + SVCERR << "WARNING: Colour3DPlotLayer::getRenderer: resetting " + << "minValue and maxValue to zero and one" << endl; + minValue = 0.f; + maxValue = 1.f; + } } cparams.threshold = minValue;