diff options
author | Eliseo Martínez <eliseomarmol@gmail.com> | 2015-03-31 11:26:32 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-04-07 20:04:34 -0400 |
commit | 3c57f5a0e18455cb54974780b02a9903b043b725 (patch) | |
tree | 924e999ed5c962eac1d54b114b9989ef7e496caa /src | |
parent | af8adc2d8c0af9906aaa719cf3e1a8b2b34ecb4a (diff) | |
download | rneovim-3c57f5a0e18455cb54974780b02a9903b043b725.tar.gz rneovim-3c57f5a0e18455cb54974780b02a9903b043b725.tar.bz2 rneovim-3c57f5a0e18455cb54974780b02a9903b043b725.zip |
Fix warnings: window.c: close_last_window_tabpage(): Np deref: RI.
Problem : Dereference of null pointer @ 1769.
Diagnostic : Real issue.
Rationale : It seems buffer could be null. Not sure, though.
Resolution : Check for buffer null.
This resolution was chosen as it will always work.
But it could be that buffer can't really be null at that
point. autocmd_win is ruled out by close_window, so that
can't be the case. I'm not sure if other windows without
buffers are possible, so leaving it this way.
If it's confirmed buffer can't be null, resolution through
an assert would be possible and this would be FP, not RI.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/window.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c index 9f07f2bddc..9c56cc5b82 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -1766,7 +1766,7 @@ static int close_last_window_tabpage(win_T *win, int free_buf, tabpage_T *prev_c } buf_T *old_curbuf = curbuf; - Terminal *term = win->w_buffer->terminal; + Terminal *term = win->w_buffer ? win->w_buffer->terminal : NULL; if (term) { // Don't free terminal buffers free_buf = false; |