comboctl-main: Catch getParsedDisplayFrame() exceptions and rethrow later

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
This commit is contained in:
Carlos Rafael Giani 2022-11-20 18:31:44 +01:00
parent 8d6171db49
commit 03a32f09cf

View file

@ -395,7 +395,16 @@ suspend fun longPressRTButtonUntil(
rtNavigationContext.getParsedDisplayFrame(filterDuplicates = true) rtNavigationContext.getParsedDisplayFrame(filterDuplicates = true)
} }
} catch (e: TimeoutCancellationException) { } catch (e: TimeoutCancellationException) {
// Timeout expired, and we got no new frame. Stop waiting
// for one and continue long-pressing the button. We might
// be on a screen that does not update on its own.
null null
} catch (t: Throwable) {
// An exception that's not TimeoutCancellationException
// was thrown. Catch it, store it to rethrow it later,
// and end the long button press.
thrownDuringButtonPress = t
return@startLongButtonPress false
} ?: return@startLongButtonPress true } ?: return@startLongButtonPress true
// It is possible that we got a parsed display frame very quickly. // It is possible that we got a parsed display frame very quickly.