Mercurial > hg > svgui
diff layer/Colour3DPlotLayer.cpp @ 1378:f08a3b8cdb9d
Avoid nan/inf values (and consequent crash) in colour scale range
author | Chris Cannam |
---|---|
date | Tue, 06 Nov 2018 13:35:47 +0000 |
parents | a1393b4384a5 |
children | c8a6fd3f9dff 79032214f79d |
line wrap: on
line diff
--- 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;