fixed early dereference error

pull/2810/head
ArneshRC 2024-01-19 16:00:13 +05:30
parent dacffdb095
commit d14a4a2b1a
No known key found for this signature in database
GPG Key ID: 92806D9D6C659F84
1 changed files with 2 additions and 1 deletions

View File

@ -701,7 +701,6 @@ void waybar::modules::Battery::setBarClass(std::string& state) {
return classname.rfind(prefix, 0) == 0; return classname.rfind(prefix, 0) == 0;
}); });
auto old_class = *old_class_it;
auto new_class = prefix + state; auto new_class = prefix + state;
// If the bar doesn't have any `battery-` class // If the bar doesn't have any `battery-` class
@ -712,6 +711,8 @@ void waybar::modules::Battery::setBarClass(std::string& state) {
return; return;
} }
auto old_class = *old_class_it;
// If the bar has a `battery-` class, // If the bar has a `battery-` class,
// but `state` is empty // but `state` is empty
if(state.empty()) { if(state.empty()) {