diff --git a/front_end/src/utils/math.ts b/front_end/src/utils/math.ts index c87e6dc07..993a5841c 100644 --- a/front_end/src/utils/math.ts +++ b/front_end/src/utils/math.ts @@ -278,9 +278,9 @@ export function getCdfAt(x: number, cdf: number[], scaling: Scaling) { const lowerIndex = Math.floor(floatIndex); const upperIndex = Math.ceil(floatIndex); const weight = floatIndex - lowerIndex; - /* eslint-disable @typescript-eslint/no-non-null-assertion */ - return cdf[lowerIndex]! * (1 - weight) + cdf[upperIndex]! * weight; - /* eslint-enable @typescript-eslint/no-non-null-assertion */ + return ( + (cdf[lowerIndex] || 0) * (1 - weight) + (cdf[upperIndex] || 1) * weight + ); } /**