FreeSpaceBar: Make sure bar size isn't negative
Fixes crash with CD drives.
This commit is contained in:
@@ -134,7 +134,7 @@ void FreeSpaceBar::DrawBar(QPainter *p, const QRect r) {
|
||||
p->setRenderHint(QPainter::Antialiasing, true);
|
||||
|
||||
QRect bar_rect(r);
|
||||
bar_rect.setWidth(static_cast<int>(static_cast<float>(bar_rect.width()) * (static_cast<float>(total_ - free_) / static_cast<float>(total_))));
|
||||
bar_rect.setWidth(std::max(0, static_cast<int>(static_cast<float>(bar_rect.width()) * (static_cast<float>(total_ - free_) / static_cast<float>(total_)))));
|
||||
|
||||
QLinearGradient background_gradient(r.topLeft(), r.bottomLeft());
|
||||
background_gradient.setColorAt(0, kColorBg1);
|
||||
|
||||
Reference in New Issue
Block a user