Index: src/eval.c
===================================================================
--- src/eval.c	(revision 134)
+++ src/eval.c	(working copy)
@@ -10432,18 +10432,16 @@
 
     if (win != NULL && varname != NULL)
     {
+	/* Set curwin to be our win, temporarily. */
+	oldcurwin = curwin;
+	curwin = win;
 	if (*varname == '&')	/* window-local-option */
 	{
-	    /* Set curwin to be our win, temporarily.  Also set curbuf, so
-	     * that we can get buffer-local options. */
-	    oldcurwin = curwin;
-	    curwin = win;
+	    /* Also set curbuf, so that we can get buffer-local options. */
 	    curbuf = win->w_buffer;
 
 	    get_option_tv(&varname, rettv, 1);
 
-	    /* restore previous notion of curwin */
-	    curwin = oldcurwin;
 	    curbuf = curwin->w_buffer;
 	}
 	else
@@ -10458,6 +10456,8 @@
 	    if (v != NULL)
 		copy_tv(&v->di_tv, rettv);
 	}
+	/* restore previous notion of curwin */
+	curwin = oldcurwin;
     }
 
     --emsg_off;
