summaryrefslogtreecommitdiff
path: root/src/undo.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-08-23 22:32:35 +0200
committerBram Moolenaar <Bram@vim.org>2017-08-23 22:32:35 +0200
commit829aa64cf5a113bb683ddf8b32e483e0696602ea (patch)
tree8b6025cfbfa43e4233fd385208e25de1d364e431 /src/undo.c
parentd2c45a1964ddb0d9ac16c9c985051fab41f37840 (diff)
downloadvim-git-829aa64cf5a113bb683ddf8b32e483e0696602ea.tar.gz
patch 8.0.0988: warning from Covscan about using NULL pointerv8.0.0988
Problem: Warning from Covscan about using NULL pointer. Solution: Add extra check for NULL. (zdohnal)
Diffstat (limited to 'src/undo.c')
-rw-r--r--src/undo.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/undo.c b/src/undo.c
index b913841f7..62963a995 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -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)