fix(Workspaces): check thread is running before parse response

pull/130/head
Alexis 2019-01-13 22:23:09 +01:00
parent 171e0e5ae3
commit f8116132a7
1 changed files with 3 additions and 1 deletions

View File

@ -28,8 +28,10 @@ void waybar::modules::sway::Workspaces::worker()
{ {
std::lock_guard<std::mutex> lock(mutex_); std::lock_guard<std::mutex> lock(mutex_);
auto res = ipc_.sendCmd(IPC_GET_WORKSPACES); auto res = ipc_.sendCmd(IPC_GET_WORKSPACES);
if (thread_.isRunning()) {
workspaces_ = parser_.parse(res.payload); workspaces_ = parser_.parse(res.payload);
} }
}
dp.emit(); dp.emit();
} catch (const std::exception& e) { } catch (const std::exception& e) {
std::cerr << "Workspaces: " << e.what() << std::endl; std::cerr << "Workspaces: " << e.what() << std::endl;