changeset 12216:e971ef6c0dee v8.0.0988

patch 8.0.0988: warning from Covscan about using NULL pointer commit https://github.com/vim/vim/commit/829aa64cf5a113bb683ddf8b32e483e0696602ea Author: Bram Moolenaar <Bram@vim.org> Date: Wed Aug 23 22:32:35 2017 +0200 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)
author Christian Brabandt <cb@256bit.org>
date Wed, 23 Aug 2017 22:45:04 +0200
parents faa2a4381b6e
children 719492eec20b
files src/fileio.c src/undo.c src/version.c
diffstat 3 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1370,7 +1370,8 @@ retry:
 		 * Decrypt the read bytes.  This is done before checking for
 		 * EOF because the crypt layer may be buffering.
 		 */
-		if (cryptkey != NULL && size > 0)
+		if (cryptkey != NULL && curbuf->b_cryptstate != NULL
+								   && size > 0)
 		{
 		    if (crypt_works_inplace(curbuf->b_cryptstate))
 		    {
--- a/src/undo.c
+++ b/src/undo.c
@@ -921,7 +921,7 @@ undo_write(bufinfo_T *bi, char_u *ptr, s
     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)
--- a/src/version.c
+++ b/src/version.c
@@ -770,6 +770,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    988,
+/**/
     987,
 /**/
     986,