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.
This commit is contained in:
Eliseo Martínez 2014-11-07 20:50:41 +01:00
parent 9c3a3e1381
commit 3efd39a41b

View File

@ -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);