Fix code when list is empty

1 job for release/21.08
Status Name Job ID Coverage
  Build
canceled build_clazy_clang_tidy #117472