From 95ca2025ace7f271f8977a7144624b267bd1feb3 Mon Sep 17 00:00:00 2001 From: David Mohammed Date: Thu, 19 Jan 2023 20:39:50 +0000 Subject: [PATCH] power: Don't assert if we can't find the widget for a profile In some cases, it was possible for a profile to be set (directly, or through a hold) even though it wasn't supported. Don't assert in those cases. Origin: upstream da7b4db1627901b63439608d3700f3100e4aa9dd --- panels/power/cc-power-panel.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c index 3a81949e10..171e488758 100644 --- a/panels/power/cc-power-panel.c +++ b/panels/power/cc-power-panel.c @@ -1119,7 +1119,10 @@ performance_profile_set_active (CcPowerPanel *self, GtkRadioButton *button; button = cc_power_profile_row_get_radio_button (CC_POWER_PROFILE_ROW (self->power_profiles_row[profile])); - g_assert (button); + if (!button) { + g_warning ("Not setting profile '%s' as it doesn't have a widget", profile_str); + return; + } gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); }