fix(xworkspaces): FPE when no _NET_DESKTOP_NAMES (#1576)

Fixes #1462
This commit is contained in:
Matthias Viehweger 2019-01-03 18:59:55 +01:00 committed by Patrick Ziegler
parent c3ef99b719
commit dec801a114

View File

@ -163,7 +163,12 @@ namespace modules {
bounds.erase(std::unique(bounds.begin(), bounds.end(), [](auto& a, auto& b) { return a == b; }), bounds.end()); bounds.erase(std::unique(bounds.begin(), bounds.end(), [](auto& a, auto& b) { return a == b; }), bounds.end());
unsigned int step = m_desktop_names.size() / bounds.size(); unsigned int step;
if (bounds.size() > 0) {
step = m_desktop_names.size() / bounds.size();
} else {
step = 1;
}
unsigned int offset = 0; unsigned int offset = 0;
for (unsigned int i = 0; i < bounds.size(); i++) { for (unsigned int i = 0; i < bounds.size(); i++) {
if (!m_pinworkspaces || m_bar.monitor->match(bounds[i])) { if (!m_pinworkspaces || m_bar.monitor->match(bounds[i])) {