Skip to content

Commit

Permalink
also handle parsing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Jun 14, 2024
1 parent a550bb8 commit 47a6902
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions stdlib/REPL/src/Pkg_beforeload.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,14 @@ end

function projname(project_file::String)
if isfile(project_file)
p = Base.TOML.Parser()
Base.TOML.reinit!(p, read(project_file, String); filepath=project_file)
proj = Base.TOML.parse(p)
name = get(proj, "name", nothing)
try
p = Base.TOML.Parser()
Base.TOML.reinit!(p, read(project_file, String); filepath=project_file)
proj = Base.TOML.parse(p)
name = get(proj, "name", nothing)
catch
name = nothing
end
else
name = nothing
end
Expand Down

0 comments on commit 47a6902

Please sign in to comment.