diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp index 8928f0a72e..c986b3bbf8 100644 --- a/src/servers/app/Window.cpp +++ b/src/servers/app/Window.cpp @@ -1436,6 +1436,9 @@ Window::HasModal() const /*! \brief Returns the windows that's in behind of the backmost position this window can get. Returns NULL is this window can be the backmost window. + + \param workspace the workspace on which this check should be made. If + the value is -1, the window's current workspace will be used. */ Window* Window::Backmost(Window* window, int32 workspace) @@ -1443,6 +1446,10 @@ Window::Backmost(Window* window, int32 workspace) if (workspace == -1) workspace = fCurrentWorkspace; + ASSERT(workspace != -1); + if (workspace == -1) + return NULL; + // Desktop windows are always backmost if (fFeel == kDesktopWindowFeel) return NULL; @@ -1465,6 +1472,9 @@ Window::Backmost(Window* window, int32 workspace) /*! \brief Returns the windows that's in front of the frontmost position this window can get. Returns NULL if this window can be the frontmost window. + + \param workspace the workspace on which this check should be made. If + the value is -1, the window's current workspace will be used. */ Window* Window::Frontmost(Window* first, int32 workspace) @@ -1472,6 +1482,10 @@ Window::Frontmost(Window* first, int32 workspace) if (workspace == -1) workspace = fCurrentWorkspace; + ASSERT(workspace != -1); + if (workspace == -1) + return NULL; + if (fFeel == kDesktopWindowFeel) return first ? first : NextWindow(workspace);