Skip to content

Commit f5afdf9

Browse files
authored
Profile: fix indent computation BoundsError (#34806)
fixes #34723
1 parent 8720530 commit f5afdf9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

stdlib/Profile/src/Profile.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,9 @@ function indent(depth::Int)
543543
depth < 1 && return ""
544544
depth <= length(indent_z) && return indent_s[1:indent_z[depth]]
545545
div, rem = divrem(depth, length(indent_z))
546-
return (indent_s^div) * SubString(indent_s, 1, indent_z[rem])
546+
indent = indent_s^div
547+
rem != 0 && (indent *= SubString(indent_s, 1, indent_z[rem]))
548+
return indent
547549
end
548550

549551
function tree_format(frames::Vector{<:StackFrameTree}, level::Int, cols::Int, maxes, filenamemap::Dict{Symbol,String}, showpointer::Bool)

0 commit comments

Comments
 (0)