I'm getting a very weird exception in a custom `La...
# compose
d
I'm getting a very weird exception in a custom
Layout
Copy code
check(measureables.size == 3) { "layout algorithm relies on 3 items in layout" }
val placeables = measureables.map { it.measure(constrains) }
layout(width, height) {
  val topPlaceable = placeables[0]
  val zoomPlaceable = placeables[1]
  // VVVV crashes on the line below with 
  //   IndexOutOfBounds(index=10, size=3)
  val locationPlaceable = placeables[2]
}
Index out of bound with index
10
(sometimes
12
) which isn't anywhere in my code. Can this be due to some compose compiler plugin magic? 🤔
👀 1
a
Are those measurables in any lazy layout?
d
Nope, they're in the
Box
which is screen's "root" and has
fillMaxSize
. What's also strange is that initially layout works OK, but after 20-30 seconds on the screen (which is dynamic, so some recompositions are taking place), it crashes, pointing to the source line with
placeables[2]
and
index=10