From 001788e87688244b73abf32de22c692c32365a1f Mon Sep 17 00:00:00 2001 From: Cody Tapscott <84105208+topolarity@users.noreply.github.com> Date: Tue, 7 May 2024 10:14:58 -0400 Subject: [PATCH] fix handling of `nothing` in init_load_path (#54382) As-written, this was checking for `nothing` after the `String` convert, which will obviously throw a MethodError. --------- Co-authored-by: Jeff Bezanson Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com> --- base/initdefs.jl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/base/initdefs.jl b/base/initdefs.jl index 182984ae01d56..60fbaded1b282 100644 --- a/base/initdefs.jl +++ b/base/initdefs.jl @@ -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