fixed scrollbar divide by zero

This commit is contained in:
fourtf 2018-01-06 20:57:01 +01:00
parent b8e268f969
commit 29046b3aa1

View file

@ -219,6 +219,11 @@ void Scrollbar::paintEvent(QPaintEvent *)
// draw highlights // draw highlights
auto snapshot = this->highlights.getSnapshot(); auto snapshot = this->highlights.getSnapshot();
int snapshotLength = (int)snapshot.getLength(); int snapshotLength = (int)snapshot.getLength();
if (snapshotLength == 0) {
return;
}
int w = this->width(); int w = this->width();
float y = 0; float y = 0;
float dY = (this->height() - MIN_THUMB_HEIGHT) / snapshotLength; float dY = (this->height() - MIN_THUMB_HEIGHT) / snapshotLength;