coverity/13728: Null pointer dereference (#6100)

coverity claims that `valid_tabpage(NULL)` can return true...
This commit is contained in:
Justin M. Keyes 2017-02-12 21:09:52 +01:00 committed by GitHub
parent 2ddadaa28c
commit 770d60d904

View File

@ -4216,6 +4216,8 @@ do_arg_all (
win_T *new_curwin = NULL; win_T *new_curwin = NULL;
tabpage_T *new_curtab = NULL; tabpage_T *new_curtab = NULL;
assert(firstwin != NULL); // satisfy coverity
if (ARGCOUNT <= 0) { if (ARGCOUNT <= 0) {
/* Don't give an error message. We don't want it when the ":all" /* Don't give an error message. We don't want it when the ":all"
* command is in the .vimrc. */ * command is in the .vimrc. */
@ -4407,19 +4409,23 @@ do_arg_all (
/* Remove the "lock" on the argument list. */ /* Remove the "lock" on the argument list. */
alist_unlink(alist); alist_unlink(alist);
--autocmd_no_enter; autocmd_no_enter--;
/* restore last referenced tabpage's curwin */ // restore last referenced tabpage's curwin
if (last_curtab != new_curtab) { if (last_curtab != new_curtab) {
if (valid_tabpage(last_curtab)) if (valid_tabpage(last_curtab)) {
goto_tabpage_tp(last_curtab, TRUE, TRUE); goto_tabpage_tp(last_curtab, true, true);
if (win_valid(last_curwin)) }
if (win_valid(last_curwin)) {
win_enter(last_curwin, false); win_enter(last_curwin, false);
}
} }
/* to window with first arg */ // to window with first arg
if (valid_tabpage(new_curtab)) if (valid_tabpage(new_curtab)) {
goto_tabpage_tp(new_curtab, TRUE, TRUE); goto_tabpage_tp(new_curtab, true, true);
if (win_valid(new_curwin)) }
if (win_valid(new_curwin)) {
win_enter(new_curwin, false); win_enter(new_curwin, false);
}
--autocmd_no_leave; --autocmd_no_leave;
xfree(opened); xfree(opened);