0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.0.0988: warning from Covscan about using NULL pointer

Problem:    Warning from Covscan about using NULL pointer.
Solution:   Add extra check for NULL. (zdohnal)
This commit is contained in:
Bram Moolenaar
2017-08-23 22:32:35 +02:00
parent d2c45a1964
commit 829aa64cf5
3 changed files with 5 additions and 2 deletions

View File

@@ -921,7 +921,7 @@ undo_write(bufinfo_T *bi, char_u *ptr, size_t len)
static int
undo_flush(bufinfo_T *bi)
{
if (bi->bi_buffer != NULL && bi->bi_used > 0)
if (bi->bi_buffer != NULL && bi->bi_state != NULL && bi->bi_used > 0)
{
crypt_encode_inplace(bi->bi_state, bi->bi_buffer, bi->bi_used);
if (fwrite(bi->bi_buffer, bi->bi_used, (size_t)1, bi->bi_fp) != 1)