Commit b66d607
Sources sheet: fix NPE on open — second init block runs after snapshots is built
The single init block was launching a `snapshots.collect { ... }` to fill
the time-series buffers, but the `snapshots` val is declared AFTER the
init block. Kotlin runs init blocks interleaved with property initialisers
in declaration order, so at the point the init body ran, `snapshots` was
still null — every open of the sheet crashed with NPE inside
StateFlow.collect.
Split into two init blocks: the first handles the IMU/RaceBox trail
launches (no `snapshots` dependency); the second sits below the snapshots
val declaration and handles the series append loop.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 8c0e870 commit b66d607
1 file changed
Lines changed: 22 additions & 12 deletions
Lines changed: 22 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
124 | 116 | | |
125 | 117 | | |
126 | 118 | | |
| |||
191 | 183 | | |
192 | 184 | | |
193 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
194 | 204 | | |
195 | 205 | | |
196 | 206 | | |
| |||
0 commit comments