changeset 8356:e0d576743e4f v7.4.1470

commit https://github.com/vim/vim/commit/289a90551d185c307abd4cfe6baadea8990d956b Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 2 21:09:32 2016 +0100 patch 7.4.1470 Problem: Coverity reports missing restore. Solution: Move json_encode() call up.
author Christian Brabandt <cb@256bit.org>
date Wed, 02 Mar 2016 21:15:05 +0100
parents 306724b3a93e
children d1cc355d581a
files src/channel.c src/version.c
diffstat 2 files changed, 13 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -1551,22 +1551,22 @@ may_invoke_callback(channel_T *channel, 
     {
 	if (buffer != NULL)
 	{
-	    buf_T	*save_curbuf = curbuf;
-	    linenr_T	lnum = buffer->b_ml.ml_line_count;
-
-	    /* Append to the buffer */
-	    ch_logn(channel, "appending line %d to buffer", (int)lnum + 1);
-
-	    curbuf = buffer;
-	    u_sync(TRUE);
-	    /* ignore undo failure, undo is not very useful here */
-	    ignored = u_save(lnum, lnum + 1);
-
 	    if (msg == NULL)
 		/* JSON or JS mode: re-encode the message. */
 		msg = json_encode(listtv, ch_mode);
 	    if (msg != NULL)
 	    {
+		buf_T	    *save_curbuf = curbuf;
+		linenr_T    lnum = buffer->b_ml.ml_line_count;
+
+		/* Append to the buffer */
+		ch_logn(channel, "appending line %d to buffer", (int)lnum + 1);
+
+		curbuf = buffer;
+		u_sync(TRUE);
+		/* ignore undo failure, undo is not very useful here */
+		ignored = u_save(lnum, lnum + 1);
+
 		ml_append(lnum, msg, 0, FALSE);
 		appended_lines_mark(lnum, 1L);
 		curbuf = save_curbuf;
--- a/src/version.c
+++ b/src/version.c
@@ -744,6 +744,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1470,
+/**/
     1469,
 /**/
     1468,