diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2015-10-26 12:48:42 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-10-26 12:48:42 -0400 |
commit | 77e93a65fe9a435fd80735777777bc7adb9a20c3 (patch) | |
tree | 54cb4986f137243f547921eae9bc7a77d880c47d | |
parent | 29d64a901df6eff436b100374b2a240eea1906d9 (diff) | |
parent | be6b784766655d38ea28fb382d3af6789e4e4a89 (diff) | |
download | rneovim-77e93a65fe9a435fd80735777777bc7adb9a20c3.tar.gz rneovim-77e93a65fe9a435fd80735777777bc7adb9a20c3.tar.bz2 rneovim-77e93a65fe9a435fd80735777777bc7adb9a20c3.zip |
Merge pull request #3502 from ZyX-I/fix-xdg
option: Fix typos that may lead to SEGV in some cases
-rw-r--r-- | src/nvim/option.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index a4cfe45f10..f30d10d0bb 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -333,7 +333,7 @@ static inline size_t compute_double_colon_len(const char *const val, const size_t single_suf_len) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_PURE { - if (val == NULL && *val) { + if (val == NULL || *val == NUL) { return 0; } size_t ret = 0; @@ -378,7 +378,7 @@ static inline char *add_colon_dirs(char *dest, const char *const val, const bool forward) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_RET FUNC_ATTR_NONNULL_ARG(1) { - if (val == NULL && *val) { + if (val == NULL || *val == NUL) { return dest; } const void *iter = NULL; @@ -435,7 +435,7 @@ static inline char *add_dir(char *dest, const char *const dir, const char *const suf2, const size_t len2) FUNC_ATTR_NONNULL_RET FUNC_ATTR_NONNULL_ARG(1) FUNC_ATTR_WARN_UNUSED_RESULT { - if (dir == NULL && dir_len != 0) { + if (dir == NULL || dir_len == 0) { return dest; } dest = strcpy_comma_escaped(dest, dir, dir_len); |