summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/window.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/window.c b/src/core/window.c
index 86f9d69b1..a83f99894 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -3750,11 +3750,15 @@ maybe_move_attached_dialog (MetaWindow *window,
*
* Gets index of the monitor that this window is on.
*
- * Return Value: The index of the monitor in the screens monitor list
+ * Return Value: The index of the monitor in the screens monitor list, or -1
+ * if the window has been recently unmanaged and does not have a monitor.
*/
int
meta_window_get_monitor (MetaWindow *window)
{
+ if (!window->monitor)
+ return -1;
+
return window->monitor->number;
}