aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-11-08 22:48:17 -0500
committerGitHub <noreply@github.com>2020-11-08 22:48:17 -0500
commit4e6f00dd29332ce549006e8df1b1392ed4209954 (patch)
tree0c5671c8e96454a752c160f6778a088186c6cb31 /src/nvim/ex_cmds.c
parent94062831b38941a3516bb3bdc8c20486a91fd900 (diff)
downloadrneovim-4e6f00dd29332ce549006e8df1b1392ed4209954.tar.gz
rneovim-4e6f00dd29332ce549006e8df1b1392ed4209954.tar.bz2
rneovim-4e6f00dd29332ce549006e8df1b1392ed4209954.zip
gcc/analyzer: fix false positives for NULL (#13248)
Close https://github.com/neovim/neovim/issues/13158
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r--src/nvim/ex_cmds.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 3e49d7845d..55366842b0 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -3451,13 +3451,13 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
sub_firstline = NULL;
- /*
- * ~ in the substitute pattern is replaced with the old pattern.
- * We do it here once to avoid it to be replaced over and over again.
- * But don't do it when it starts with "\=", then it's an expression.
- */
- if (!(sub[0] == '\\' && sub[1] == '='))
+ // ~ in the substitute pattern is replaced with the old pattern.
+ // We do it here once to avoid it to be replaced over and over again.
+ // But don't do it when it starts with "\=", then it's an expression.
+ assert(sub != NULL);
+ if (!(sub[0] == '\\' && sub[1] == '=')) {
sub = regtilde(sub, p_magic);
+ }
// Check for a match on each line.
// If preview: limit to max('cmdwinheight', viewport).