mirror of
https://github.com/polybar/polybar.git
synced 2026-03-01 05:19:54 +00:00
fix(timer_module): Ensure that interval > 0 (#2274)
Since 3.5.0, we use m_interval for a modulo operation, this crashes the bar if the interval is 0. A non-positive interval shouldn't be allowed anyway, so we now throw an exception in that case. Fixes #2273
This commit is contained in:
@ -16,7 +16,7 @@ namespace modules {
|
||||
template class module<memory_module>;
|
||||
|
||||
memory_module::memory_module(const bar_settings& bar, string name_) : timer_module<memory_module>(bar, move(name_)) {
|
||||
m_interval = m_conf.get<decltype(m_interval)>(name(), "interval", 1s);
|
||||
set_interval(1s);
|
||||
|
||||
m_formatter->add(DEFAULT_FORMAT, TAG_LABEL, {TAG_LABEL, TAG_BAR_USED, TAG_BAR_FREE, TAG_RAMP_USED, TAG_RAMP_FREE,
|
||||
TAG_BAR_SWAP_USED, TAG_BAR_SWAP_FREE, TAG_RAMP_SWAP_USED, TAG_RAMP_SWAP_FREE});
|
||||
|
||||
Reference in New Issue
Block a user