monitor-manager: use g_return_val_if_fail if trying to fetch an invalid monitor

https://bugzilla.gnome.org/show_bug.cgi?id=788860
This commit is contained in:
Marco Trevisan (Treviño) 2017-10-13 00:10:22 -05:00
parent b31e545c9d
commit f044511037

View File

@ -2345,7 +2345,7 @@ MetaLogicalMonitor *
meta_monitor_manager_get_logical_monitor_from_number (MetaMonitorManager *manager, meta_monitor_manager_get_logical_monitor_from_number (MetaMonitorManager *manager,
int number) int number)
{ {
g_assert ((unsigned int) number < g_list_length (manager->logical_monitors)); g_return_val_if_fail ((unsigned int) number < g_list_length (manager->logical_monitors), NULL);
return g_list_nth (manager->logical_monitors, number)->data; return g_list_nth (manager->logical_monitors, number)->data;
} }