Skip to content

Commit

Permalink
handle potential error
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-sidhdhi-p committed Nov 15, 2024
1 parent 8acba20 commit 26af31b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions data/lib/service/match/match_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,10 @@ class MatchService {

final list = await Future.wait(
teamList.map((matchPlayer) async {
final team =
teams.firstWhere((element) => element.id == matchPlayer.team_id);
final team = teams.firstWhere(
(element) => element.id == matchPlayer.team_id,
orElse: () => deActiveDummyTeamModel(matchPlayer.team_id),
);

final squad = await getPlayerListFromPlayerIds(matchPlayer.squad);
return matchPlayer.copyWith(team: team, squad: squad);
Expand Down

0 comments on commit 26af31b

Please sign in to comment.