@@ -10,9 +10,13 @@ using std::placeholders::_2;
10
10
11
11
namespace {
12
12
template <typename T>
13
- bool vectorContains (std::vector<T> & v, T k) {
13
+ bool vectorContains (std::vector<T> const & v, T k) {
14
14
return std::find (v.begin (), v.end (), k) != v.end ();
15
15
}
16
+
17
+ bool isValidId (std::string const & id) {
18
+ return !(id.empty () || id == " 00000000-0000-0000-0000-000000000000" );
19
+ }
16
20
}
17
21
18
22
namespace ear {
@@ -212,8 +216,7 @@ void BinauralMonitoringBackend::onSceneReceived(proto::SceneStore store) {
212
216
213
217
for (const auto & item : store.all_available_items ()) {
214
218
if (item.has_connection_id () &&
215
- item.connection_id () != " 00000000-0000-0000-0000-000000000000" &&
216
- item.connection_id () != " " ) {
219
+ isValidId (item.connection_id ())) {
217
220
availableItemIds.push_back (item.connection_id ());
218
221
}
219
222
if (item.has_ds_metadata ()) {
@@ -246,8 +249,7 @@ void BinauralMonitoringBackend::onSceneReceived(proto::SceneStore store) {
246
249
247
250
for (const auto & item : store.monitoring_items ()) {
248
251
if (item.has_connection_id () &&
249
- item.connection_id () != " 00000000-0000-0000-0000-000000000000" &&
250
- item.connection_id () != " " &&
252
+ isValidId (item.connection_id ()) &&
251
253
vectorContains (availableItemIds, item.connection_id ())) {
252
254
253
255
bool newItem = !vectorContains (allActiveIds, item.connection_id ());
0 commit comments