diff --git a/src/modules/battery.cpp b/src/modules/battery.cpp index 96985d8a..05f2f8a8 100644 --- a/src/modules/battery.cpp +++ b/src/modules/battery.cpp @@ -67,8 +67,11 @@ void BatteryModule::subthread_runner() { std::this_thread::yield(); - const auto dur = std::chrono::duration( - float(this->animation_charging->get_framerate()) / 1000.0f); + std::chrono::duration dur = 1s; + + if (this->animation_charging) + dur = std::chrono::duration( + float(this->animation_charging->get_framerate()) / 1000.0f); int i = 0; const int poll_seconds = config::get(name(), "poll_interval", 3.0f) / dur.count();