To reproduce this bug first create in Local profile plugin a new empty profile (+ button), but keep this profile "not valid" (LocalProfile1 is created with red background)
Then create one or several valid profiles after this "Wrong entry"
Because of one wrong profile included in profileStore, if you select the latest profile in Local Profile list and you click on "Activate Profile" button, AAPS will crash here (ProfileSwitchDialog.kt line 135)
binding.profileList.setText(profileList[profileIndex as Int], false)
with this in Logcat
java.lang.IndexOutOfBoundsException: Index: 8, Size: 8
at java.util.ArrayList.get(ArrayList.java:437)
at info.nightscout.androidaps.dialogs.ProfileSwitchDialog.onViewCreated(ProfileSwitchDialog.kt:135)
I think it's because when you fill profileIndex list, the wrong profile is not added in profileIndex because of test line 125 (size of profileStore and size of profileIndex are different...)
for (profileName in profileListToCheck) {
val profileToCheck = activePlugin.activeProfileSource.profile?.getSpecificProfile(profileName.toString())
if (profileToCheck != null && ProfileSealed.Pure(profileToCheck).isValid("ProfileSwitch", activePlugin.activePump, config, rh, rxBus, hardLimits, false).isValid)
profileList.add(profileName)
}
To reproduce this bug first create in Local profile plugin a new empty profile (+ button), but keep this profile "not valid" (LocalProfile1 is created with red background)
Then create one or several valid profiles after this "Wrong entry"
Because of one wrong profile included in profileStore, if you select the latest profile in Local Profile list and you click on "Activate Profile" button, AAPS will crash here (
ProfileSwitchDialog.kt
line 135)binding.profileList.setText(profileList[profileIndex as Int], false)
with this in Logcat
I think it's because when you fill profileIndex list, the wrong profile is not added in profileIndex because of test line 125 (size of profileStore and size of profileIndex are different...)