From 29046b3aa12b1e76eda538b288a3d724cf5832a2 Mon Sep 17 00:00:00 2001 From: fourtf Date: Sat, 6 Jan 2018 20:57:01 +0100 Subject: [PATCH] fixed scrollbar divide by zero --- src/widgets/scrollbar.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/widgets/scrollbar.cpp b/src/widgets/scrollbar.cpp index efde86a1..1acb0eb1 100644 --- a/src/widgets/scrollbar.cpp +++ b/src/widgets/scrollbar.cpp @@ -219,6 +219,11 @@ void Scrollbar::paintEvent(QPaintEvent *) // draw highlights auto snapshot = this->highlights.getSnapshot(); int snapshotLength = (int)snapshot.getLength(); + + if (snapshotLength == 0) { + return; + } + int w = this->width(); float y = 0; float dY = (this->height() - MIN_THUMB_HEIGHT) / snapshotLength;