fix(battery): Safety check

Make sure returned label is valid before access.

Refs #318
This commit is contained in:
Michael Carlberg 2017-01-11 15:01:38 +01:00
parent 30201bac38
commit d7d0fbcae4

View File

@ -198,12 +198,14 @@ namespace modules {
}
}();
if (label) {
label->reset_tokens();
label->replace_token("%percentage%", to_string(m_percentage) + "%");
if (m_state != battery_module::state::FULL && !m_timeformat.empty()) {
label->replace_token("%time%", current_time());
}
}
return true;
}