diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-02-12 21:09:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-12 21:09:52 +0100 |
commit | 770d60d9049cbc34aee1973d838d33c2945c1c76 (patch) | |
tree | d2a5b68b4719a19706c9b1a87cbc37950ad44161 | |
parent | 2ddadaa28cd62cb601779a1d53ea41aee13482de (diff) | |
download | rneovim-770d60d9049cbc34aee1973d838d33c2945c1c76.tar.gz rneovim-770d60d9049cbc34aee1973d838d33c2945c1c76.tar.bz2 rneovim-770d60d9049cbc34aee1973d838d33c2945c1c76.zip |
coverity/13728: Null pointer dereference (#6100)
coverity claims that `valid_tabpage(NULL)` can return true...
-rw-r--r-- | src/nvim/buffer.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 1089a2dc3b..a471ebf06f 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -4216,6 +4216,8 @@ do_arg_all ( win_T *new_curwin = NULL; tabpage_T *new_curtab = NULL; + assert(firstwin != NULL); // satisfy coverity + if (ARGCOUNT <= 0) { /* Don't give an error message. We don't want it when the ":all" * command is in the .vimrc. */ @@ -4407,19 +4409,23 @@ do_arg_all ( /* Remove the "lock" on the argument list. */ alist_unlink(alist); - --autocmd_no_enter; - /* restore last referenced tabpage's curwin */ + autocmd_no_enter--; + // restore last referenced tabpage's curwin if (last_curtab != new_curtab) { - if (valid_tabpage(last_curtab)) - goto_tabpage_tp(last_curtab, TRUE, TRUE); - if (win_valid(last_curwin)) + if (valid_tabpage(last_curtab)) { + goto_tabpage_tp(last_curtab, true, true); + } + if (win_valid(last_curwin)) { win_enter(last_curwin, false); + } + } + // to window with first arg + if (valid_tabpage(new_curtab)) { + goto_tabpage_tp(new_curtab, true, true); } - /* to window with first arg */ - if (valid_tabpage(new_curtab)) - goto_tabpage_tp(new_curtab, TRUE, TRUE); - if (win_valid(new_curwin)) + if (win_valid(new_curwin)) { win_enter(new_curwin, false); + } --autocmd_no_leave; xfree(opened); |