[gnome-control-center/wip/hadess/power-profile-not-exist: 25/25] power: Don't assert if we can't find the widget for a profile




commit da7b4db1627901b63439608d3700f3100e4aa9dd
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Sep 8 11:51:37 2022 +0200

    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.
    
    Closes: #1504

 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 0a988b5d4..9fb0bbd83 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -993,7 +993,10 @@ performance_profile_set_active (CcPowerPanel  *self,
   GtkCheckButton *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_check_button_set_active (GTK_CHECK_BUTTON (button), TRUE);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]