you can probably remove this line and replace tag->GenreType() by item->GetEPGInfoTag()->GenreType() without the cast