Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef1bab89 authored by Jordan Silva's avatar Jordan Silva
Browse files

Fix crash when OverviewCommandHelper queue is cleared before callback response

This issue should not happen after b/364860731 fix. The issue happened because the queue was cleared while a command was being processed. Then, onTransitionComplete callback returned and checked if the first item of the queue was the same processed, but the queue was empty.
To prevent future cases of NoSuchElementException, we updated the logic to check the firstOrNull item from the queue.

Fix: 364986456
Bug: 364860731
Flag: EXEMPT bugfix
Test: Manual
Change-Id: Iaa606943db3ff89a7f3012260663c41954d720a7
parent 64832004
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -362,11 +362,11 @@ class OverviewCommandHelper(
    /** Called when the command finishes execution. */
    private fun onCommandFinished(command: CommandInfo) {
        command.status = CommandStatus.COMPLETED
        if (commandQueue.first() !== command) {
        if (commandQueue.firstOrNull() !== command) {
            Log.d(
                TAG,
                "next task not scheduled. First pending command type " +
                    "is ${commandQueue.first()} - command type is: $command"
                    "is ${commandQueue.firstOrNull()} - command type is: $command"
            )
            return
        }