diff --git a/src/cargo/core/compiler/timings/timings.js b/src/cargo/core/compiler/timings/timings.js index 50b5a2f51be..20cf81983e4 100644 --- a/src/cargo/core/compiler/timings/timings.js +++ b/src/cargo/core/compiler/timings/timings.js @@ -531,14 +531,17 @@ class SvgRenderer { const axes = this._draw_graph_axes({ canvas_height, graph_height, graph_width, px_per_sec }); // Draw Y tick marks. - const path_commands = Array(units.length - 1) - .fill(0) - .map((_, idx) => { - const n = idx + 1; - const y = MARGIN + Y_TICK_DIST * n; - return `M${X_LINE} ${y} h-5`; - }); - const y_ticks = ``; + let y_ticks = ''; + if (units.length != 0) { + const path_commands = Array(units.length - 1) + .fill(0) + .map((_, idx) => { + const n = idx + 1; + const y = MARGIN + Y_TICK_DIST * n; + return `M${X_LINE} ${y} h-5`; + }); + y_ticks = ``; + } // Draw Y labels. const y_labels = Array(units.length)