diff src/channel.c @ 31263:d8e7d725a666 v9.0.0965

patch 9.0.0965: using one window for executing autocommands is insufficient Commit: https://github.com/vim/vim/commit/e76062c078debed0df818f70e4db14ad7a7cb53a Author: Bram Moolenaar <Bram@vim.org> Date: Mon Nov 28 18:51:43 2022 +0000 patch 9.0.0965: using one window for executing autocommands is insufficient Problem: Using one window for executing autocommands is insufficient. Solution: Use up to five windows for executing autocommands.
author Bram Moolenaar <Bram@vim.org>
date Mon, 28 Nov 2022 20:00:05 +0100
parents 74e64f3a54ef
children fa309d9af73c
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -2872,8 +2872,14 @@ append_to_buffer(buf_T *buffer, char_u *
 
     buffer->b_p_ma = TRUE;
 
-    // set curbuf to be our buf, temporarily
+    // Set curbuf to "buffer", temporarily.
     aucmd_prepbuf(&aco, buffer);
+    if (curbuf != buffer)
+    {
+	// Could not find a window for this buffer, the following might cause
+	// trouble, better bail out.
+	return;
+    }
 
     u_sync(TRUE);
     // ignore undo failure, undo is not very useful here