aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/quickfix.c
diff options
context:
space:
mode:
authorMarco Hinz <mh.codebro@gmail.com>2019-05-03 11:40:09 +0200
committerMarco Hinz <mh.codebro@gmail.com>2019-05-04 01:40:11 +0200
commit624dbfdd44ee012b6f621529bb9ab56cd749ddc6 (patch)
tree9ee03ae6b180e1e6d4052154958b00dc7a5c4e2a /src/nvim/quickfix.c
parent06b70bf1d68a9d022d8eb6db41184c7bd930a5b5 (diff)
downloadrneovim-624dbfdd44ee012b6f621529bb9ab56cd749ddc6.tar.gz
rneovim-624dbfdd44ee012b6f621529bb9ab56cd749ddc6.tar.bz2
rneovim-624dbfdd44ee012b6f621529bb9ab56cd749ddc6.zip
vim-patch:8.0.1500: possible NULL pointer dereference
Problem: Possible NULL pointer dereference. (Coverity) Solution: Check for the pointer not being NULL. https://github.com/vim/vim/commit/0549a1e184d33674f4c2b8fb44ccdf6b9b9808a3
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r--src/nvim/quickfix.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index f9882e9561..d8156c22cb 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -3296,7 +3296,7 @@ void ex_make(exarg_T *eap)
if (au_name != NULL) {
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
curbuf->b_fname, TRUE, curbuf);
- if (qi->qf_curlist < qi->qf_listcount)
+ if (qi != NULL && qi->qf_curlist < qi->qf_listcount)
res = qi->qf_lists[qi->qf_curlist].qf_count;
else
res = 0;
@@ -3652,13 +3652,15 @@ void ex_cfile(exarg_T *eap)
if (res >= 0 && qi != NULL) {
qf_list_changed(qi, qi->qf_curlist);
}
- unsigned save_qfid = qi->qf_lists[qi->qf_curlist].qf_id;
+ unsigned save_qfid;
+ if (qi != NULL)
+ save_qfid = qi->qf_lists[qi->qf_curlist].qf_id;
if (au_name != NULL) {
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, NULL, false, curbuf);
}
// Autocmd might have freed the quickfix/location list. Check whether it is
// still valid
- if (!qflist_valid(wp, save_qfid)) {
+ if (qi != NULL && !qflist_valid(wp, save_qfid)) {
return;
}
if (res > 0 && (eap->cmdidx == CMD_cfile || eap->cmdidx == CMD_lfile)) {