diff --git a/cmd/lncli/main.go b/cmd/lncli/main.go index 4600c8ff..b0e6292d 100644 --- a/cmd/lncli/main.go +++ b/cmd/lncli/main.go @@ -252,10 +252,13 @@ func main() { // passed path, cleans the result, and returns it. // This function is taken from https://github.com/btcsuite/btcd func cleanAndExpandPath(path string) string { + if path == "" { + return "" + } + // Expand initial ~ to OS specific home directory. if strings.HasPrefix(path, "~") { var homeDir string - user, err := user.Current() if err == nil { homeDir = user.HomeDir diff --git a/config.go b/config.go index 10571f98..de339da5 100644 --- a/config.go +++ b/config.go @@ -934,10 +934,13 @@ func loadConfig() (*config, error) { // passed path, cleans the result, and returns it. // This function is taken from https://github.com/btcsuite/btcd func cleanAndExpandPath(path string) string { + if path == "" { + return "" + } + // Expand initial ~ to OS specific home directory. if strings.HasPrefix(path, "~") { var homeDir string - user, err := user.Current() if err == nil { homeDir = user.HomeDir