Skip to content

Commit

Permalink
make dump tolerate undefined fields. fixes JuliaLang#3386
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jun 13, 2013
1 parent 93ccbd6 commit c18f4ee
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function show(io::IO, x::ANY)
for i=1:n
f = t.names[i]
if !isdefined(x, f)
print(io, "#undef")
print(io, undef_ref_str)
else
show(io, x.(f))
end
Expand Down Expand Up @@ -450,7 +450,11 @@ function xdump(fn::Function, io::IO, x, n::Int, indent)
for field in T.names
if field != symbol("") # prevents segfault if symbol is blank
print(io, indent, " ", field, ": ")
fn(io, getfield(x, field), n - 1, string(indent, " "))
if isdefined(x,field)
fn(io, getfield(x, field), n - 1, string(indent, " "))
else
println(io, undef_ref_str)
end
end
end
end
Expand Down

0 comments on commit c18f4ee

Please sign in to comment.