diff --git a/Library/OcBootManagementLib/OcBootManagementLib.c b/Library/OcBootManagementLib/OcBootManagementLib.c index 4f84a6f3..20c8e7e4 100644 --- a/Library/OcBootManagementLib/OcBootManagementLib.c +++ b/Library/OcBootManagementLib/OcBootManagementLib.c @@ -977,23 +977,23 @@ OcWaitForAppleKeyIndex ( return OC_INPUT_INVALID; } - NumKeys = ARRAY_SIZE (Keys); - Status = KeyMap->GetKeyStrokes ( - KeyMap, - &Modifiers, - &NumKeys, - Keys - ); - - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "OCB: GetKeyStrokes - %r\n", Status)); - return OC_INPUT_INVALID; - } - CurrTime = GetTimeInNanoSecond (GetPerformanceCounter ()); EndTime = CurrTime + Timeout * 1000000000ULL; while (Timeout == 0 || CurrTime == 0 || CurrTime < EndTime) { + NumKeys = ARRAY_SIZE (Keys); + Status = KeyMap->GetKeyStrokes ( + KeyMap, + &Modifiers, + &NumKeys, + Keys + ); + + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "OCB: GetKeyStrokes - %r\n", Status)); + return OC_INPUT_INVALID; + } + CurrTime = GetTimeInNanoSecond (GetPerformanceCounter ()); HasCommand = (Modifiers & (APPLE_MODIFIER_LEFT_COMMAND | APPLE_MODIFIER_RIGHT_COMMAND)) != 0;