diff --git a/src/shell-global.c b/src/shell-global.c index 8077b9d1f..3d7878064 100644 --- a/src/shell-global.c +++ b/src/shell-global.c @@ -1113,18 +1113,18 @@ shell_global_get_primary_monitor (ShellGlobal *global) { /* Prefer the laptop's internal screen if present */ output_name = gdk_screen_get_monitor_plug_name (screen, i); - if (output_name && g_ascii_strncasecmp (output_name, "LVDS", 4) == 0) - { - primary = i; - break; - } if (output_name) - g_free (output_name); + { + gboolean is_lvds = g_ascii_strncasecmp (output_name, "LVDS", 4) == 0; + g_free (output_name); + if (is_lvds) + { + primary = i; + break; + } + } } - if (output_name) - g_free (output_name); - gdk_screen_get_monitor_geometry (screen, primary, &rect); return g_boxed_copy (GDK_TYPE_RECTANGLE, &rect);