Skip to content

Commit

Permalink
Merge pull request #372 from sustainable-git/Fix/Crash
Browse files Browse the repository at this point in the history
[Fix] 기록을 터치하였을 때 앱이 크래시나는 버그
  • Loading branch information
sustainable-git authored Dec 1, 2021
2 parents 934d5f7 + ff3002c commit fe9c3dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion SanTa/SanTa/Scenes/ResultDetailScene/ResultDetailModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ struct ResultPace {
let slowestPace: TimeInterval

init(records: Records) {
self.timePerKilometer = records.totalTravelTime / records.distances
if records.distances == 0 {
self.timePerKilometer = 0
} else {
self.timePerKilometer = records.totalTravelTime / records.distances
}
self.fastestPace = TimeInterval(records.secondPerHighestSpeed)
self.slowestPace = TimeInterval(records.secondPerMinimumSpeed)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ final class ResultDetailViewModel {
guard let distance = self.resultDetailData?.distance.total,
let totalTime = self.resultDetailData?.time.spent, totalTime > 0,
let speed = formatter.string(from: NSNumber(value: distance * 3600 / totalTime)) else {
return "-"
return "알 수 없음"
}
if distance == 0 { return "-" }
return speed
}

Expand Down

0 comments on commit fe9c3dd

Please sign in to comment.