From 9c8f88ed45ce0296d268cfe11648e05acef39d64 Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Mon, 25 Aug 2025 10:13:21 +0200 Subject: [PATCH] fix issue with groupstage possible crash when calculating score add the ability to always create a final table structure --- PadelClubData/Data/Match.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PadelClubData/Data/Match.swift b/PadelClubData/Data/Match.swift index 8deb733..60aa3eb 100644 --- a/PadelClubData/Data/Match.swift +++ b/PadelClubData/Data/Match.swift @@ -875,7 +875,7 @@ defer { let endedSetsTwo = teamScoreOtherTeam.score?.components(separatedBy: ",").compactMap({ $0.components(separatedBy: "-").first }).compactMap({ Int($0) }) ?? matchFormat.defaultWalkOutScore(teamScoreOtherTeam.isWalkOut()) var setDifference : Int = 0 let zip = zip(endedSetsOne, endedSetsTwo) - if matchFormat.setsToWin == 1 { + if matchFormat.setsToWin == 1, endedSetsOne.count > 0, endedSetsTwo.count > 0 { setDifference = endedSetsOne[0] - endedSetsTwo[0] } else { setDifference = zip.filter { $0 > $1 }.count - zip.filter { $1 > $0 }.count