aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-02-19 00:20:34 -0500
committerJustin M. Keyes <justinkz@gmail.com>2016-02-19 02:00:22 -0500
commit06e53aa487d3a36a18ece4b639801bc5c59bd0be (patch)
tree385b89b9b772c688dfd997b8bfada53994bdfa0b /src/nvim/buffer.c
parent91254bd9d8a849463b63e6d07569157e2491c98e (diff)
downloadrneovim-06e53aa487d3a36a18ece4b639801bc5c59bd0be.tar.gz
rneovim-06e53aa487d3a36a18ece4b639801bc5c59bd0be.tar.bz2
rneovim-06e53aa487d3a36a18ece4b639801bc5c59bd0be.zip
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.
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r--src/nvim/buffer.c9
1 files changed, 6 insertions, 3 deletions
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: