fix(xwindow): Crash when no tag is set in format (#2833)

* xwindow works without tag

* changelog
This commit is contained in:
Ashwin Rajesh 2022-10-06 06:39:02 +11:00 committed by GitHub
parent 5719d130fd
commit 03987b19a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 8 deletions

View File

@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- config:
- Error reporting for deprecated config values ([`#2724`](https://github.com/polybar/polybar/issues/2724))
- Also monitor include-files for changes when --reload is set ([`#675`](https://github.com/polybar/polybar/issues/675), [`#2759`](https://github.com/polybar/polybar/pull/2759))
- `internal/xwindow`: module does not crash when a tag is not provided in format ([`#2826`](https://github.com/polybar/polybar/issues/2826), [`#2833`](https://github.com/polybar/polybar/pull/2833)) by [@VanillaViking](https://github.com/VanillaViking)
## [3.6.3] - 2022-05-04
### Fixed

View File

@ -123,14 +123,16 @@ namespace modules {
}
}
if (m_active) {
m_label = m_statelabels.at(state::ACTIVE)->clone();
m_label->reset_tokens();
m_label->replace_token("%title%", m_active->title());
m_label->replace_token("%instance%", m_active->instance_name());
m_label->replace_token("%class%", m_active->class_name());
} else {
m_label = m_statelabels.at(state::EMPTY)->clone();
if (!m_statelabels.empty()) {
if (m_active) {
m_label = m_statelabels.at(state::ACTIVE)->clone();
m_label->reset_tokens();
m_label->replace_token("%title%", m_active->title());
m_label->replace_token("%instance%", m_active->instance_name());
m_label->replace_token("%class%", m_active->class_name());
} else {
m_label = m_statelabels.at(state::EMPTY)->clone();
}
}
}