Fix some coverity and cppcheck issues

This commit is contained in:
heckflosse
2017-06-18 18:40:40 +02:00
parent ae67344f16
commit 8aff354df9
14 changed files with 30 additions and 27 deletions

View File

@@ -1179,6 +1179,7 @@ void HistogramArea::drawCurve(Cairo::RefPtr<Cairo::Context> &cr,
LUTu & data, double scale, int hsize, int vsize)
{
cr->move_to (0, vsize - 1);
scale = scale <= 0.f ? 0.001f : scale; // avoid division by zero and negative values
for (int i = 0; i < 256; i++) {
double val = data[i] * (double)(vsize - 2) / scale;