aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/optionstr.c
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2023-07-13 16:31:11 +0100
committerLewis Russell <lewis6991@gmail.com>2023-08-31 15:08:52 +0100
commitaf3c667ac13e23b5ff838e720c8b26fa4a12644a (patch)
treeec8b26354327eb2bb278dcc3252d082f4bba3efa /src/nvim/optionstr.c
parent6a449a892bdc25f4984b1cd4dcbe4e7157142a46 (diff)
downloadrneovim-af3c667ac13e23b5ff838e720c8b26fa4a12644a.tar.gz
rneovim-af3c667ac13e23b5ff838e720c8b26fa4a12644a.tar.bz2
rneovim-af3c667ac13e23b5ff838e720c8b26fa4a12644a.zip
refactor(option): option clearing
Diffstat (limited to 'src/nvim/optionstr.c')
-rw-r--r--src/nvim/optionstr.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c
index c0a7bfa3f7..c68ee65fcf 100644
--- a/src/nvim/optionstr.c
+++ b/src/nvim/optionstr.c
@@ -429,12 +429,16 @@ void set_string_option_direct_in_buf(buf_T *buf, const char *name, int opt_idx,
/// #OPT_GLOBAL.
///
/// @return NULL on success, an untranslated error message on error.
-const char *set_string_option(const int opt_idx, const char *const value, const int opt_flags,
+const char *set_string_option(const int opt_idx, const char *value, const int opt_flags,
bool *value_checked, char *const errbuf, const size_t errbuflen)
- FUNC_ATTR_NONNULL_ARG(2) FUNC_ATTR_WARN_UNUSED_RESULT
+ FUNC_ATTR_WARN_UNUSED_RESULT
{
vimoption_T *opt = get_option(opt_idx);
+ if (value == NULL) {
+ value = "";
+ }
+
char **varp = (char **)get_varp_scope(opt, ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
? ((opt->indir & PV_BOTH) ? OPT_GLOBAL : OPT_LOCAL)
: opt_flags));