summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2017-04-12 14:24:25 +0800
committerJonas Ådahl <jadahl@gmail.com>2017-08-30 13:09:38 +0800
commit24c91d95de97a3313591703c61297da4ca7dc6d3 (patch)
tree6347f36fd53231a33babf9142bd1174cf55db860
parent7562eb600659e86304d90f3fe666116a081c75ea (diff)
downloadmutter-24c91d95de97a3313591703c61297da4ca7dc6d3.tar.gz
core/screen: Make logical monitor getters handle being headless
Don't crash or return invalid indices when we are headless. https://bugzilla.gnome.org/show_bug.cgi?id=730551
-rw-r--r--src/core/screen.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/screen.c b/src/core/screen.c
index 503c20195..98c5538e3 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -1515,6 +1515,9 @@ meta_screen_get_monitor_index_for_rect (MetaScreen *screen,
logical_monitor =
meta_monitor_manager_get_logical_monitor_from_rect (monitor_manager, rect);
+ if (!logical_monitor)
+ return -1;
+
return logical_monitor->number;
}
@@ -1604,7 +1607,7 @@ meta_screen_get_primary_monitor (MetaScreen *screen)
if (logical_monitor)
return logical_monitor->number;
else
- return 0;
+ return -1;
}
/**