Skip to content

Commit

Permalink
Reverse order of keydefpath checks (#17566)
Browse files Browse the repository at this point in the history
If keydefpath is nothing, we can't call `isempty` on it, so we should check for that first.

Fixes #17553
  • Loading branch information
Keno authored Jul 22, 2016
1 parent 809138f commit 3503a59
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions base/libgit2/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function credentials_callback(cred::Ptr{Ptr{Void}}, url_ptr::Cstring,
if keydefpath !== nothing && !isusedcreds
keydefpath # use cached value
else
if isempty(keydefpath) || keydefpath === nothing
if keydefpath === nothing || isempty(keydefpath)
keydefpath = joinpath(homedir(),".ssh","id_rsa")
end
prompt("Private key location for '$schema$username@$host'", default=keydefpath)
Expand All @@ -130,7 +130,7 @@ function credentials_callback(cred::Ptr{Ptr{Void}}, url_ptr::Cstring,
if keydefpath !== nothing && !isusedcreds
keydefpath # use cached value
else
if isempty(keydefpath) || keydefpath === nothing
if keydefpath === nothing || isempty(keydefpath)
keydefpath = privatekey*".pub"
end
if isfile(keydefpath)
Expand Down

0 comments on commit 3503a59

Please sign in to comment.