Error when using multiselect options in DHIS2 Android v3.1.01

Hi DHIS2 community,

I’m encountering an IndexOutOfBoundsException when using multi-select inputs in a tracker program in the DHIS2 Android app version 3.1. Here’s the specific error:

java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 7

The error occurs in:

org.dhis2.form.ui.provider.inputfield.MultiSelectionInputProviderKt.ProvideMultiSelectionInput

Steps to reproduce:

  • Open a form with a multi-select field

  • Try to select an option

  • Error occurs when interacting with the multi-select dialog

Error details:

java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 7 at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266) at java.util.Objects.checkIndex(Objects.java:359) at java.util.ArrayList.get(ArrayList.java:434) at org.dhis2.form.ui.provider.inputfield.MultiSelectionInputProviderKt.ProvideMultiSelectionInput$lambda$7$lambda$6(MultiSelectionInputProvider.kt:50) at org.dhis2.form.ui.provider.inputfield.MultiSelectionInputProviderKt.$r8$lambda$zXl4jb6e5zZ7CjEBLOwpODE6BY0(Unknown Source:0) at org.dhis2.form.ui.provider.inputfield.MultiSelectionInputProviderKt$$ExternalSyntheticLambda0.invoke(D8$$SyntheticClass:0) at org.hisp.dhis.mobile.ui.designsystem.component.InputMultiSelectionKt.InputMultiSelection$lambda$11$lambda$8$lambda$7(InputMultiSelection.kt:232) at org.hisp.dhis.mobile.ui.designsystem.component.InputMultiSelectionKt.$r8$lambda$

Expected behavior:

Should be able to select multiple options from the multi-select input without errors.

Actual behavior:

App throws an IndexOutOfBoundsException when interacting with multi-select inputs.

Has anyone else encountered this issue or found a workaround? Any help would be appreciated.

1 Like

Hi @Quoda!

This might be related to this issue

It will be fixed for the 3.1.1 patch release.

Sorry for the inconvenience.

Ahaa, that’s the issue!
I have reverted to 3.0 and it works fine for me.

Thank you.

1 Like