diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.c | 3 | ||||
-rw-r--r-- | src/nvim/main.c | 1 | ||||
-rw-r--r-- | src/nvim/option.c | 2 | ||||
-rw-r--r-- | src/nvim/os/stdpaths.c | 4 |
4 files changed, 7 insertions, 3 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index a3540b3153..de40bea0dd 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -15712,6 +15712,9 @@ static void get_xdg_var_list(const XDGVarType xdg, typval_T *rettv) rettv->vval.v_list = list; tv_list_ref(list); char *const dirs = stdpaths_get_xdg_var(xdg); + if (dirs == NULL) { + return; + } do { size_t dir_len; const char *dir; diff --git a/src/nvim/main.c b/src/nvim/main.c index a4ed868af1..23cea3e592 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -1849,6 +1849,7 @@ static void source_startup_scripts(const mparm_T *const parmp) /// @return FAIL if the environment variable was not executed, /// OK otherwise. static int process_env(char *env, bool is_viminit) + FUNC_ATTR_NONNULL_ALL { const char *initstr = os_getenv(env); if (initstr != NULL) { diff --git a/src/nvim/option.c b/src/nvim/option.c index 1da259e6b8..68f76296c7 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -6585,7 +6585,7 @@ void vimrc_found(char_u *fname, char_u *envname) { char_u *p; - if (fname != NULL) { + if (fname != NULL && envname != NULL) { p = (char_u *)vim_getenv((char *)envname); if (p == NULL) { /* Set $MYVIMRC to the first vimrc file found. */ diff --git a/src/nvim/os/stdpaths.c b/src/nvim/os/stdpaths.c index 866a005228..f6503dfdb0 100644 --- a/src/nvim/os/stdpaths.c +++ b/src/nvim/os/stdpaths.c @@ -65,7 +65,7 @@ char *stdpaths_get_xdg_var(const XDGVarType idx) const char *env_val = os_getenv(env); #ifdef WIN32 - if (env_val == NULL) { + if (env_val == NULL && xdg_defaults_env_vars[idx] != NULL) { env_val = os_getenv(xdg_defaults_env_vars[idx]); } #endif @@ -74,7 +74,7 @@ char *stdpaths_get_xdg_var(const XDGVarType idx) if (env_val != NULL) { ret = xstrdup(env_val); } else if (fallback) { - ret = (char *) expand_env_save((char_u *)fallback); + ret = (char *)expand_env_save((char_u *)fallback); } return ret; |