Commit d7e83355 authored by Guido Gunther's avatar Guido Gunther Committed by Guido Gunther

PhoshMonitor: Don't access inexistent modes

If we don't receive any modes don't access them accidentally.
Signed-off-by: Guido Gunther's avatarGuido Günther <guido.gunther@puri.sm>
parent 24c3f571
......@@ -302,6 +302,7 @@ PhoshMonitorMode *
phosh_monitor_get_current_mode (PhoshMonitor *self)
{
g_return_val_if_fail (PHOSH_IS_MONITOR (self), NULL);
g_return_val_if_fail (self->current_mode < self->modes->len, NULL);
return &g_array_index (self->modes, PhoshMonitorMode, self->current_mode);
}
......
......@@ -653,6 +653,7 @@ phosh_shell_get_usable_area (PhoshShell *self, gint *x, gint *y, gint *width, gi
monitor = phosh_shell_get_primary_monitor (self);
g_return_if_fail(monitor);
mode = phosh_monitor_get_current_mode (monitor);
g_return_if_fail (mode != NULL);
scale = monitor->scale ? monitor->scale : 1;
if (priv->rotation) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment