Repository: xbmc/xbmc
File: xbmc/windows/GUIMediaWindow.cpp (C++)

Code before:
    // Remove ZIP, RAR files and folders
    CFileItemList playlist;
    playlist.Copy(*m_vecItems, true);
    playlist.erase(std::remove_if(playlist.begin(), playlist.end(),
                                  [](const std::shared_ptr<CFileItem>& i)
                                  {
                                    const CFileItem& j = *i.get();
                                    return j.IsZIP() || j.IsRAR() || j.m_bIsFolder;
                                  }),
                   playlist.end());

    // Remove duplicates (eg. ISO/VIDEO_TS)
    playlist.erase(
        std::unique(playlist.begin(), playlist.end(),
                    [](const std::shared_ptr<CFileItem>& i, const std::shared_ptr<CFileItem>& j) {
                      return i.get()->GetVideoInfoTag()->m_basePath ==
                             j.get()->GetVideoInfoTag()->m_basePath;
                    }),
        playlist.end());

    // Chosen item
    int mediaToPlay = std::distance(playlist.begin(),
                                    std::find_if(playlist.begin(), playlist.end(),
                                                 [&item](const std::shared_ptr<CFileItem>& i) {
                                                   return i.get()->GetVideoInfoTag()->m_basePath ==
                                                          item.get()->GetVideoInfoTag()->m_basePath;
                                                 }));

    // Add to playlist
    CServiceBroker::GetPlaylistPlayer().ClearPlaylist(playlistId);
    CServiceBroker::GetPlaylistPlayer().Reset();
    CServiceBroker::GetPlaylistPlayer().Add(playlistId, playlist);

    // Save current window and directory to know where the selected item was
    if (m_guiState)
      m_guiState->SetPlaylistDirectory(m_vecItems->GetPath());

    // figure out where we start playback
    if (CServiceBroker::GetPlaylistPlayer().IsShuffled(playlistId))
    {
      int iIndex =
          CServiceBroker::GetPlaylistPlayer().GetPlaylist(playlistId).FindOrder(mediaToPlay);
      CServiceBroker::GetPlaylistPlayer().GetPlaylist(playlistId).Swap(0, iIndex);
      mediaToPlay = 0;
    }

    // play
    CServiceBroker::GetPlaylistPlayer().SetCurrentPlaylist(playlistId);
    CServiceBroker::GetPlaylistPlayer().Play(mediaToPlay, player);
  }
  return true;

Review comment (suggestion):
```suggestion
                                                   return i->GetVideoInfoTag()->m_basePath ==
                                                          item->GetVideoInfoTag()->m_basePath;
```

Code after:
  PLAYLIST::Id playlistId = m_guiState->GetPlaylist();
  if (playlistId != PLAYLIST::TYPE_NONE)
  {
    // Remove ZIP, RAR files and folders
    CFileItemList playlist;
    playlist.Copy(*m_vecItems, true);
    playlist.erase(std::remove_if(playlist.begin(), playlist.end(),
                                  [](const std::shared_ptr<CFileItem>& i)
                                  { return i->IsZIP() || i->IsRAR() || i->m_bIsFolder; }),
                   playlist.end());

    // Remove duplicates (eg. ISO/VIDEO_TS)
    playlist.erase(
        std::unique(playlist.begin(), playlist.end(),
                    [](const std::shared_ptr<CFileItem>& i, const std::shared_ptr<CFileItem>& j) {
                      return i->GetVideoInfoTag()->m_basePath == j->GetVideoInfoTag()->m_basePath;
                    }),
        playlist.end());

    // Chosen item
    int mediaToPlay =
        std::distance(playlist.begin(), std::find_if(playlist.begin(), playlist.end(),
                                                     [&item](const std::shared_ptr<CFileItem>& i) {
                                                       return i->GetVideoInfoTag()->m_basePath ==
                                                              item->GetVideoInfoTag()->m_basePath;
                                                     }));

    // Add to playlist
    CServiceBroker::GetPlaylistPlayer().ClearPlaylist(playlistId);
    CServiceBroker::GetPlaylistPlayer().Reset();
    CServiceBroker::GetPlaylistPlayer().Add(playlistId, playlist);

    // Save current window and directory to know where the selected item was
    if (m_guiState)
      m_guiState->SetPlaylistDirectory(m_vecItems->GetPath());

    // figure out where we start playback
    if (CServiceBroker::GetPlaylistPlayer().IsShuffled(playlistId))
    {
      int iIndex =
          CServiceBroker::GetPlaylistPlayer().GetPlaylist(playlistId).FindOrder(mediaToPlay);
      CServiceBroker::GetPlaylistPlayer().GetPlaylist(playlistId).Swap(0, iIndex);
      mediaToPlay = 0;
    }

    // play
    CServiceBroker::GetPlaylistPlayer().SetCurrentPlaylist(playlistId);
    CServiceBroker::GetPlaylistPlayer().Play(mediaToPlay, player);
  }
  return true;
}