Merge branch 'jk/config-path-include-fix'
[gitweb.git] / path.c
diff --git a/path.c b/path.c
index 24594c41120bebab1e04f5bc4bd8fc484ea71b97..f9c5062427e7d8170a1e2e597fcf22ae517a865e 100644 (file)
--- a/path.c
+++ b/path.c
@@ -265,12 +265,12 @@ static struct passwd *getpw_str(const char *username, size_t len)
 char *expand_user_path(const char *path)
 {
        struct strbuf user_path = STRBUF_INIT;
-       const char *first_slash = strchrnul(path, '/');
        const char *to_copy = path;
 
        if (path == NULL)
                goto return_null;
        if (path[0] == '~') {
+               const char *first_slash = strchrnul(path, '/');
                const char *username = path + 1;
                size_t username_len = first_slash - username;
                if (username_len == 0) {