Because failed stages may be removed by job cancellation, it is possible for failed to be empty by the time the ResubmitFailedStages event makes it to the head of the message queue, so the prior conditional wasn't meaningless.  On the other hand, resubmitFailedStages will do the right thing (nothing) when failed is empty, so the guard isn't strictly needed, either.