From 3bc9308abcd1ff2ffe081ee694b60ef5ea07e8de Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Mon, 22 Jun 2015 14:30:21 +0200 Subject: [PATCH] MenuScroller: fixed error when scrolling with the mouse wheel but there is nothing to scroll --- app/src/processing/app/tools/MenuScroller.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/processing/app/tools/MenuScroller.java b/app/src/processing/app/tools/MenuScroller.java index d92c33a48..f82f0be69 100644 --- a/app/src/processing/app/tools/MenuScroller.java +++ b/app/src/processing/app/tools/MenuScroller.java @@ -441,6 +441,10 @@ public class MenuScroller { firstIndex = Math.max(topFixedCount, firstIndex); firstIndex = Math.min(menuItems.length - bottomFixedCount - scrollCount, firstIndex); + if (firstIndex < 0) { + return; + } + upItem.setEnabled(firstIndex > topFixedCount); downItem.setEnabled(firstIndex + scrollCount < menuItems.length - bottomFixedCount);