Skip to content

Commit 3503a59

Browse files
authored
Reverse order of keydefpath checks (#17566)
If keydefpath is nothing, we can't call `isempty` on it, so we should check for that first. Fixes #17553
1 parent 809138f commit 3503a59

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

base/libgit2/callbacks.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function credentials_callback(cred::Ptr{Ptr{Void}}, url_ptr::Cstring,
114114
if keydefpath !== nothing && !isusedcreds
115115
keydefpath # use cached value
116116
else
117-
if isempty(keydefpath) || keydefpath === nothing
117+
if keydefpath === nothing || isempty(keydefpath)
118118
keydefpath = joinpath(homedir(),".ssh","id_rsa")
119119
end
120120
prompt("Private key location for '$schema$username@$host'", default=keydefpath)
@@ -130,7 +130,7 @@ function credentials_callback(cred::Ptr{Ptr{Void}}, url_ptr::Cstring,
130130
if keydefpath !== nothing && !isusedcreds
131131
keydefpath # use cached value
132132
else
133-
if isempty(keydefpath) || keydefpath === nothing
133+
if keydefpath === nothing || isempty(keydefpath)
134134
keydefpath = privatekey*".pub"
135135
end
136136
if isfile(keydefpath)

0 commit comments

Comments
 (0)