Skip to content

Commit

Permalink
Make get median safer
Browse files Browse the repository at this point in the history
  • Loading branch information
xbjfk committed Jul 27, 2024
1 parent 1845f2e commit d65e7a3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CubeTime/StopwatchManager/StopwatchManager+Stats.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ extension StopwatchManager {


} else {
// I don't know why this is needed
if !solves.indices.contains(cnt/2) {
return (nil, nil)
}
let median = Double(solves[(cnt/2)].timeIncPen)

if let truncatedMin = truncatedValues.0, let truncatedMax = truncatedValues.1 {
Expand Down

0 comments on commit d65e7a3

Please sign in to comment.