patch 8.0.0707: freeing wrong memory with certain autocommands

Problem:    Freeing wrong memory when manipulating buffers in autocommands.
            (James McCoy)
Solution:   Also set the w_s pointer if w_buffer was NULL.
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 39f658a..a69a052 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -3968,8 +3968,8 @@
 		     * <VN> We could instead free the synblock
 		     * and re-attach to buffer, perhaps.
 		     */
-		    if (curwin->w_buffer != NULL
-			    && 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;