diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-01-13 17:47:14 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-01-13 19:57:52 +0100 |
commit | 4cba75dab08ce718ff3e7500ca943789c1099c4e (patch) | |
tree | bbd5c9b9c1e873099cd8f222707d680fd850721a /src | |
parent | 1ec0b9204ba2187c860566e3169d23337caab386 (diff) | |
download | rneovim-4cba75dab08ce718ff3e7500ca943789c1099c4e.tar.gz rneovim-4cba75dab08ce718ff3e7500ca943789c1099c4e.tar.bz2 rneovim-4cba75dab08ce718ff3e7500ca943789c1099c4e.zip |
clang/"null pointer dereference": close_buffer
False positive: win_valid_any_tab() already checks `win != NULL`.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/buffer.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 22c8a2bf05..c15a6f1330 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -447,7 +447,8 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last) return; } - if (win_valid_any_tab(win)) { + if (win != NULL // Avoid bogus clang warning. + && win_valid_any_tab(win)) { // Set b_last_cursor when closing the last window for the buffer. // Remember the last cursor position and window options of the buffer. // This used to be only for the current window, but then options like @@ -575,7 +576,9 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last) if (buf == curbuf && !is_curbuf) return; - if (win_valid_any_tab(win) && win->w_buffer == buf) { + if (win != NULL // Avoid bogus clang warning. + && win_valid_any_tab(win) + && win->w_buffer == buf) { win->w_buffer = NULL; // make sure we don't use the buffer now } |