diff options
author | Paul Gilbert | 2015-08-09 11:59:52 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-08-09 11:59:52 -0400 |
commit | 28af73777b2a1cf276b38624ac6a6009cffc1fd5 (patch) | |
tree | 57dbd44695badca574be2e296645a1cc8b02da75 | |
parent | d5af7b73ec1321a2557eed01e60f0753d9716285 (diff) | |
download | scummvm-rg350-28af73777b2a1cf276b38624ac6a6009cffc1fd5.tar.gz scummvm-rg350-28af73777b2a1cf276b38624ac6a6009cffc1fd5.tar.bz2 scummvm-rg350-28af73777b2a1cf276b38624ac6a6009cffc1fd5.zip |
SHERLOCK: RT: Fix crash when clicking in inventory at start of game
-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 7a341ccaae..36202a1367 100644 --- a/engines/sherlock/tattoo/widget_base.cpp +++ b/engines/sherlock/tattoo/widget_base.cpp @@ -293,7 +293,8 @@ void WidgetBase::handleScrollbarEvents(int index, int pageSize, int count) { // Calculate 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); if (Common::Rect(r.left, r.top, r.right, r.top + BUTTON_SIZE).contains(mousePos)) // Mouse on scroll up button |