diff options
author | Paul Gilbert | 2015-07-31 18:38:32 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-07-31 18:38:32 -0400 |
commit | 238ec804cf075e36581f42430a13527febbd97b5 (patch) | |
tree | f475ffa6b5eea0ed2051e9ed3c10aa628f54a7e9 /engines/sherlock/tattoo | |
parent | 4cc2bcabe1e59a2074a5aef466911ae1bbbf351f (diff) | |
download | scummvm-rg350-238ec804cf075e36581f42430a13527febbd97b5.tar.gz scummvm-rg350-238ec804cf075e36581f42430a13527febbd97b5.tar.bz2 scummvm-rg350-238ec804cf075e36581f42430a13527febbd97b5.zip |
SHERLOCK: RT: Fix crash when scrollbar count equals page size
Diffstat (limited to 'engines/sherlock/tattoo')
-rw-r--r-- | engines/sherlock/tattoo/widget_base.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/engines/sherlock/tattoo/widget_base.cpp b/engines/sherlock/tattoo/widget_base.cpp index 539d4a2f02..856d7457b0 100644 --- a/engines/sherlock/tattoo/widget_base.cpp +++ b/engines/sherlock/tattoo/widget_base.cpp @@ -269,7 +269,8 @@ void WidgetBase::drawScrollBar(int index, int pageSize, int count) { // Draw the scroll position bar int barHeight = (r.height() - BUTTON_SIZE * 2) * pageSize / count; barHeight = CLIP(barHeight, BUTTON_SIZE, r.height() - BUTTON_SIZE * 2); - int barY = r.top + BUTTON_SIZE + (r.height() - BUTTON_SIZE * 2 - barHeight) * index / (count - pageSize); + int barY = (count <= pageSize) ? r.top + BUTTON_SIZE : r.top + BUTTON_SIZE + + (r.height() - BUTTON_SIZE * 2 - barHeight) * index / (count - pageSize); _surface.fillRect(Common::Rect(r.left + 2, barY + 2, r.right - 2, barY + barHeight - 3), INFO_MIDDLE); ui.drawDialogRect(_surface, Common::Rect(r.left, barY, r.right, barY + barHeight), true); |