Fix segmentation fault in WirePlumber module

The WirePlumber module assumes that either the node's name or
description will not be null. This leads to a segmentation fault when
both are.

The solution provided is to set self->node_name_ to a default value in
this case.
pull/2648/head
Caleb Harper 2023-11-06 09:50:13 -06:00
parent e24adbc3c2
commit 4d339f05af
No known key found for this signature in database
GPG Key ID: 0A380CB4B1EE828A
1 changed files with 1 additions and 1 deletions

View File

@ -81,7 +81,7 @@ void waybar::modules::Wireplumber::updateNodeName(waybar::modules::Wireplumber*
auto nick = wp_properties_get(properties, "node.nick"); auto nick = wp_properties_get(properties, "node.nick");
auto description = wp_properties_get(properties, "node.description"); auto description = wp_properties_get(properties, "node.description");
self->node_name_ = nick ? nick : description; self->node_name_ = nick ? nick : description ? description : "Unknown node name";
spdlog::debug("[{}]: Updating node name to: {}", self->name_, self->node_name_); spdlog::debug("[{}]: Updating node name to: {}", self->name_, self->node_name_);
} }