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:
Patrick Ziegler
2020-12-05 22:58:38 +01:00
committed by GitHub
parent b2c515c73c
commit 82ebad5e7a
9 changed files with 23 additions and 9 deletions

View File

@ -9,7 +9,7 @@ namespace modules {
counter_module::counter_module(const bar_settings& bar, string name_)
: timer_module<counter_module>(bar, move(name_)) {
m_interval = m_conf.get(name(), "interval", m_interval);
set_interval(1s);
m_formatter->add(DEFAULT_FORMAT, TAG_COUNTER, {TAG_COUNTER});
}
@ -25,6 +25,6 @@ namespace modules {
}
return false;
}
}
} // namespace modules
POLYBAR_NS_END