mirror of
https://github.com/neovim/neovim.git
synced 2024-12-26 14:11:15 -07:00
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:
parent
9c3a3e1381
commit
3efd39a41b
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user