From 4cba75dab08ce718ff3e7500ca943789c1099c4e Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 13 Jan 2019 17:47:14 +0100 Subject: clang/"null pointer dereference": close_buffer False positive: win_valid_any_tab() already checks `win != NULL`. --- src/nvim/buffer.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') 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 } -- cgit