From 817ec086a16711a60a28ffac7096806447ced3c6 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 9 Aug 2020 17:43:51 +0200 Subject: [PATCH] prevent IndexOutOfBoundsException --- .../androidaps/plugins/general/overview/OverviewFragment.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt index 595be6943f..d478d4f5fa 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt @@ -853,7 +853,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList graphData.addNowLine(now) // ------------------ 2nd graph - for (g in 0 until secondaryGraphs.size) { + for (g in 0 until min(secondaryGraphs.size, overviewMenus.setting.size + 1)) { val secondGraphData = GraphData(injector, secondaryGraphs[g], iobCobCalculatorPlugin, treatmentsPlugin) var useABSForScale = false var useIobForScale = false @@ -888,7 +888,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList } // finally enforce drawing of graphs in UI thread graphData.performUpdate() - for (g in 0 until secondaryGraphsData.size) { + for (g in 0 until min(secondaryGraphs.size, overviewMenus.setting.size + 1)) { secondaryGraphsLabel[g].text = overviewMenus.enabledTypes(g + 1) secondaryGraphs[g].visibility = ( overviewMenus.setting[g + 1][OverviewMenus.CharType.ABS.ordinal] ||