diff --git a/src/realprogressbar.cpp b/src/realprogressbar.cpp index f874a31a7..415b1efd8 100644 --- a/src/realprogressbar.cpp +++ b/src/realprogressbar.cpp @@ -90,9 +90,14 @@ void RealProgressBar::drawPixmap() QColor RealProgressBar::penColor(qreal x) { - qreal y = 1 - x; - Q_ASSERT(x >= 0.); - Q_ASSERT(y >= 0.); + if(x < 0.) + x = 0.; + else + if(x > 1.) + x = 1.; + qreal y = 1. - x; +// Q_ASSERT(x >= 0.); +// Q_ASSERT(y >= 0.); qreal r1, g1, b1, a1, r2, g2, b2, a2; foreground.getRgbF(&r1, &g1, &b1, &a1); background.getRgbF(&r2, &g2, &b2, &a2); diff --git a/src/realprogressbarthread.cpp b/src/realprogressbarthread.cpp index 576cdce6e..a0b2cca83 100644 --- a/src/realprogressbarthread.cpp +++ b/src/realprogressbarthread.cpp @@ -79,6 +79,7 @@ start: size_type piece_length = thandle.piece_length(); int num_pieces = thandle.num_pieces(); const std::vector* pieces = thandle.pieces(); + //no vector returned if (pieces == 0) return; //empty the array @@ -97,7 +98,7 @@ start: if((*pieces)[i]) mark(start, end); } - +/* //fill the array with incomplete pieces (from download queue) std::vector queue; thandle.get_download_queue(queue); @@ -116,12 +117,12 @@ start: start = end; } } -// qreal sum = 0.; -// locker.relock(); -// for(int i=0; i