[gnome-control-center/benzea/fix-no-preferred-mode-crash: 22/22] display: Fix crash if a monitor has no preferred mode
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/benzea/fix-no-preferred-mode-crash: 22/22] display: Fix crash if a monitor has no preferred mode
- Date: Tue, 30 Apr 2019 14:16:38 +0000 (UTC)
commit f75c3a8471d24bc8c4402c60cedcb0cdfcf476e3
Author: Benjamin Berg <bberg redhat com>
Date: Fri Apr 26 18:39:03 2019 +0200
display: Fix crash if a monitor has no preferred mode
When a monitor has no current mode set and also no preferred mode we ran
into a crash. Simply select the first mode we can find as a further
fallback.
panels/display/cc-display-settings.c | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/panels/display/cc-display-settings.c b/panels/display/cc-display-settings.c
index 562670298..6ab1ac832 100644
--- a/panels/display/cc-display-settings.c
+++ b/panels/display/cc-display-settings.c
@@ -269,6 +269,12 @@ cc_display_settings_rebuild_ui (CcDisplaySettings *self)
current_mode = cc_display_monitor_get_mode (self->selected_output);
if (current_mode == NULL)
current_mode = cc_display_monitor_get_preferred_mode (self->selected_output);
+ if (current_mode == NULL) {
+ modes = cc_display_monitor_get_modes (self->selected_output);
+ /* Lets assume that a monitor always has at least one mode. */
+ g_assert (modes);
+ current_mode = CC_DISPLAY_MODE (modes->data);
+ }
if (should_show_rotation (self))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]