From 06e53aa487d3a36a18ece4b639801bc5c59bd0be Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 19 Feb 2016 00:20:34 -0500 Subject: coverity/135589: (FP) Null pointer dereferences False positive: buflist_findnr() should not be NULL in this case because it is given a buffer number that (should be) guaranteed to exist. --- src/nvim/buffer.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 9806623433..c05090bbf6 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1741,12 +1741,15 @@ int buflist_findpat( int toggledollar; if (pattern_end == pattern + 1 && (*pattern == '%' || *pattern == '#')) { - if (*pattern == '%') + if (*pattern == '%') { match = curbuf->b_fnum; - else + } else { match = curwin->w_alt_fnum; - if (diffmode && !diff_mode_buf(buflist_findnr(match))) + } + buf_T *found_buf = buflist_findnr(match); + if (diffmode && !(found_buf && diff_mode_buf(found_buf))) { match = -1; + } } /* * Try four ways of matching a listed buffer: -- cgit