Skip to content

Commit 3284b7b

Browse files
committed
test(firmware): Fix StackOverflowError in OTA handler test delay override
The TestEsp32OtaUpdateEnvironment.delayBlock lambda called delay(it) unqualified, which resolved to the class's own override instead of kotlinx.coroutines.delay. Each call re-entered delayBlock, producing infinite recursion and a StackOverflowError in CoroutineDebugging. Fully qualify the call as kotlinx.coroutines.delay(it) so it resolves to the imported top-level function, not the member override.
1 parent 4131918 commit 3284b7b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

feature/firmware/src/commonTest/kotlin/org/meshtastic/feature/firmware/ota/Esp32OtaUpdateHandlerTest.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,9 @@ private class TestEsp32OtaUpdateEnvironment : Esp32OtaUpdateEnvironment {
483483
override var gattReleaseDelayMs: Long = 1_000L
484484
override var wifiDiscoveryEnabled: Boolean = false
485485

486-
var delayBlock: suspend (Long) -> Unit = { delay(it) }
486+
// Fully qualified: an unqualified `delay(it)` would resolve to this class's own override (member functions win
487+
// over imported top-level functions), producing infinite recursion through delayBlock → StackOverflowError.
488+
var delayBlock: suspend (Long) -> Unit = { kotlinx.coroutines.delay(it) }
487489
var bleTransportFactory: ((String) -> UnifiedOtaProtocol)? = null
488490
var wifiTransportFactory: ((String) -> UnifiedOtaProtocol)? = null
489491
var discoverWifiOtaDeviceBlock: suspend () -> String? = { null }

0 commit comments

Comments
 (0)