gpu-kms: Protect against NULL crtc->current_mode

When failing to apply the CRTC mode, Mutter throws a warning
message. This warning message would try to access the name of
the CRTC's current mode.

There are ocasions, however, where the current mode is NULL.
On these cases, Mutter would crash.

Fix that by protecting against NULL CRTC modes.
This commit is contained in:
Georges Basile Stavracas Neto 2018-07-14 12:58:59 -03:00
parent 161d2540e6
commit 93b9bc789c

View File

@ -148,7 +148,10 @@ meta_gpu_kms_apply_crtc_mode (MetaGpuKms *gpu_kms,
connectors, n_connectors,
mode) != 0)
{
if (crtc->current_mode)
g_warning ("Failed to set CRTC mode %s: %m", crtc->current_mode->name);
else
g_warning ("Failed to set CRTC mode: %m");
g_free (connectors);
return FALSE;
}