diff options
author | Eliseo Martínez <eliseomarmol@gmail.com> | 2014-11-07 20:50:41 +0100 |
---|---|---|
committer | Eliseo Martínez <eliseomarmol@gmail.com> | 2014-11-11 01:43:11 +0100 |
commit | 3efd39a41b598ea876c2ced322284fad0678bc1d (patch) | |
tree | 50ee18092fbdfb1796e385bbf2377f95820ce906 /src | |
parent | 9c3a3e13814c6601271288f4550d5c723ce8b4c3 (diff) | |
download | rneovim-3efd39a41b598ea876c2ced322284fad0678bc1d.tar.gz rneovim-3efd39a41b598ea876c2ced322284fad0678bc1d.tar.bz2 rneovim-3efd39a41b598ea876c2ced322284fad0678bc1d.zip |
Fix warnings: ex_cmds.c: do_ecmd(): Np dereference: FP.
Problem : Dereference of null pointer @ 2768.
Diagnostic : False positive.
Rationale : `win_valid(oldwin)` implies `oldwin` not null.
Resolution : Assert `oldwin` not null.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_cmds.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index a71ee7a2fe..ef9affcdf6 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -10,6 +10,7 @@ * ex_cmds.c: some functions for command line commands */ +#include <assert.h> #include <errno.h> #include <stdbool.h> #include <string.h> @@ -2765,9 +2766,12 @@ do_ecmd ( /* Autocommands may open a new window and leave oldwin open * which leads to crashes since the above call sets * oldwin->w_buffer to NULL. */ - if (curwin != oldwin && oldwin != aucmd_win - && win_valid(oldwin) && oldwin->w_buffer == NULL) - win_close(oldwin, FALSE); + if (curwin != oldwin && oldwin != aucmd_win && win_valid(oldwin)) { + assert(oldwin); + if (oldwin->w_buffer == NULL) { + win_close(oldwin, FALSE); + } + } if (aborting()) { /* autocmds may abort script processing */ free(new_name); |