Skip to content

Commit

Permalink
fix handling of nothing in init_load_path (#54382)
Browse files Browse the repository at this point in the history
As-written, this was checking for `nothing` after the `String` convert,
which will obviously throw a MethodError.

---------

Co-authored-by: Jeff Bezanson <jeff.bezanson@gmail.com>
Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com>
  • Loading branch information
3 people authored May 7, 2024
1 parent d9fecf1 commit 70b7442
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions base/initdefs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,14 @@ function init_load_path()
if haskey(ENV, "JULIA_LOAD_PATH")
paths = parse_load_path(ENV["JULIA_LOAD_PATH"])
else
paths = filter!(env -> env !== nothing,
String[env == "@." ? current_project() : env for env in DEFAULT_LOAD_PATH])
paths = String[]
for env in DEFAULT_LOAD_PATH
if env == "@."
env = current_project()
env === nothing && continue
end
push!(paths, env)
end
end
append!(empty!(LOAD_PATH), paths)
end
Expand Down

0 comments on commit 70b7442

Please sign in to comment.