From 40f298a4390ed2ecbedc8b60637a935ead8b9b32 Mon Sep 17 00:00:00 2001 From: Dieter Blancke Date: Thu, 18 Aug 2022 12:40:03 +0200 Subject: [PATCH 1/2] Fixed an IndexOutOfBoundsException --- .../java/gwt/material/design/client/ui/MaterialCollapsible.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsible.java b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsible.java index 80fbe50e3..6bff6efae 100644 --- a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsible.java +++ b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsible.java @@ -254,7 +254,7 @@ public void setActive(int index) { public void setActive(int index, boolean active) { activeIndex = index; if (isAttached()) { - if (index <= getWidgetCount()) { + if (index < getWidgetCount()) { if (index > 0) { activeWidget = getWidget(index); if (activeWidget != null && activeWidget instanceof MaterialCollapsibleItem) { From 03339afa601233fa700bc5bc91f684630c0d2b8c Mon Sep 17 00:00:00 2001 From: Dieter Blancke Date: Mon, 13 May 2024 14:04:39 +0200 Subject: [PATCH 2/2] Re-considering the index to be a 1-based index while still fixing the IndexOutOfBoundsException --- .../gwt/material/design/client/ui/MaterialCollapsible.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsible.java b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsible.java index 6bff6efae..6c4c2218d 100644 --- a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsible.java +++ b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsible.java @@ -254,9 +254,9 @@ public void setActive(int index) { public void setActive(int index, boolean active) { activeIndex = index; if (isAttached()) { - if (index < getWidgetCount()) { + if (index <= getWidgetCount()) { if (index > 0) { - activeWidget = getWidget(index); + activeWidget = getWidget(index - 1); if (activeWidget != null && activeWidget instanceof MaterialCollapsibleItem) { ((MaterialCollapsibleItem) activeWidget).setActive(active); reload();