File tree 2 files changed +6
-3
lines changed
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -347,7 +347,7 @@ auto UPower::update() -> void {
347
347
label_.set_markup (onlySpaces ? " " : label_format);
348
348
349
349
// Set icon
350
- if (!Gtk::IconTheme::get_default ()->has_icon (icon_name)) {
350
+ if (icon_name == NULL || !Gtk::IconTheme::get_default ()->has_icon (icon_name)) {
351
351
icon_name = (char *)" battery-missing-symbolic" ;
352
352
}
353
353
icon_.set_from_icon_name (icon_name, Gtk::ICON_SIZE_INVALID);
Original file line number Diff line number Diff line change @@ -62,7 +62,9 @@ uint UPowerTooltip::updateTooltip(Devices& devices) {
62
62
NULL );
63
63
64
64
// Skip Line_Power and BAT0 devices
65
- if (kind == UP_DEVICE_KIND_LINE_POWER || strcmp (native_path, " BAT0" ) == 0 ) continue ;
65
+ if (kind == UP_DEVICE_KIND_LINE_POWER || native_path == NULL || strlen (native_path) == 0 ||
66
+ strcmp (native_path, " BAT0" ) == 0 )
67
+ continue ;
66
68
67
69
Gtk::Box* modelBox = new Gtk::Box (Gtk::ORIENTATION_HORIZONTAL);
68
70
box->add (*modelBox);
@@ -77,6 +79,7 @@ uint UPowerTooltip::updateTooltip(Devices& devices) {
77
79
modelBox->add (*deviceIcon);
78
80
79
81
// Set model
82
+ if (model == NULL ) model = (gchar*)" " ;
80
83
Gtk::Label* modelLabel = new Gtk::Label (model);
81
84
modelBox->add (*modelLabel);
82
85
@@ -86,7 +89,7 @@ uint UPowerTooltip::updateTooltip(Devices& devices) {
86
89
// Set icon
87
90
Gtk::Image* icon = new Gtk::Image ();
88
91
icon->set_pixel_size (iconSize);
89
- if (!Gtk::IconTheme::get_default ()->has_icon (icon_name)) {
92
+ if (icon_name == NULL || !Gtk::IconTheme::get_default ()->has_icon (icon_name)) {
90
93
icon_name = (char *)" battery-missing-symbolic" ;
91
94
}
92
95
icon->set_from_icon_name (icon_name, Gtk::ICON_SIZE_INVALID);
You can’t perform that action at this time.
0 commit comments