Skip to content

Commit

Permalink
measurements: Additional guards against invalid thresholds
Browse files Browse the repository at this point in the history
Prompted by @genehack's review comment
<#1802 (comment)>
  • Loading branch information
joverlee521 committed Jul 30, 2024
1 parent 05d142c commit 172c556
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/measurements/measurementsD3.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,9 @@ export const drawMeasurementsSVG = (ref, xAxisRef, svgData) => {
drawStickyXAxis(xAxisRef, containerHeight, svgHeight, xScale, x_axis_label);

// Add threshold(s) if provided
if (thresholds !== null && thresholds !== undefined) {
if (Array.isArray(thresholds)) {
for (const threshold of thresholds) {
if (typeof threshold !== "number") continue;
const thresholdXValue = xScale(threshold);
svg.append("line")
.attr("class", classes.threshold)
Expand Down

0 comments on commit 172c556

Please sign in to comment.