patch 8.0.0134
Problem:    Null pointer access reported by UBsan.
Solution:   Check curwin->w_buffer is not NULL. (Yegappan Lakshmanan)
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 206ead1..484a22c 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -3967,7 +3967,8 @@
 		     * <VN> We could instead free the synblock
 		     * and re-attach to buffer, perhaps.
 		     */
-		    if (curwin->w_s == &(curwin->w_buffer->b_s))
+		    if (curwin->w_buffer != NULL
+			    && curwin->w_s == &(curwin->w_buffer->b_s))
 			curwin->w_s = &(buf->b_s);
 #endif
 		    curwin->w_buffer = buf;