diff --git a/src/window.c b/src/window.c index 96606a8aa6d..655515182ce 100644 --- a/src/window.c +++ b/src/window.c @@ -978,8 +978,9 @@ windows, eventually ending up back at the window you started with.\n\ #endif /* If this frame has a minibuffer, find that window first, because it is conceptually the last window in that frame. */ - tem = FRAME_MINIBUF_WINDOW (XFRAME (tem)); - if (NILP (tem)) + if (FRAME_HAS_MINIBUF_P (XFRAME (tem))) + tem = FRAME_MINIBUF_WINDOW (XFRAME (tem)); + else tem = FRAME_ROOT_WINDOW (XFRAME (tem)); break;