The frames queue might return nothing (be empty) if we're flushing. Move the assertion to after the flushing check