aboutsummaryrefslogtreecommitdiffstats
path: root/daemon/src/config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/src/config.cpp')
-rw-r--r--daemon/src/config.cpp31
1 files changed, 26 insertions, 5 deletions
diff --git a/daemon/src/config.cpp b/daemon/src/config.cpp
index b88fd0f..b711d52 100644
--- a/daemon/src/config.cpp
+++ b/daemon/src/config.cpp
@@ -87,13 +87,24 @@ add_to_routes(Device_Id const & from_device, Route_Table & rt, toml::table & rou
{
for (auto&& [name, mt] : string2type)
{
- rt[from_device][mt].push_back(cm.get_sender(to_device));
+ if (auto sender = cm.get_sender(to_device))
+ {
+ rt[from_device][mt].push_back(sender.value());
+ }
}
}
else
{
- Message_Type mt = string2type.at(type.as_string()->get());
- rt[from_device][mt].push_back(cm.get_sender(to_device));
+ if (!string2type.contains(type.as_string()->get()))
+ {
+ continue;
+ }
+
+ if (auto sender = cm.get_sender(to_device))
+ {
+ Message_Type const mt = string2type.at(type.as_string()->get());
+ rt[from_device][mt].push_back(sender.value());
+ }
}
}
}
@@ -113,6 +124,10 @@ add_type_routes(Device_Map const & device_map, Device_Id const & from_device, Ro
}
for (auto & device : *devices)
{
+ if (!string2type.contains(type))
+ {
+ continue;
+ }
Message_Type mt = string2type.at(type);
std::string to_device = device.as_string()->get();
if (to_device == "all")
@@ -120,12 +135,18 @@ add_type_routes(Device_Map const & device_map, Device_Id const & from_device, Ro
for (auto&& [name, id] : device_map)
{
if (id == from_device) continue;
- rt[from_device][mt].push_back(cm.get_sender(id));
+ if (auto sender = cm.get_sender(id))
+ {
+ rt[from_device][mt].push_back(sender.value());
+ }
}
}
else
{
- rt[from_device][mt].push_back(cm.get_sender(to_device));
+ if (auto sender = cm.get_sender(to_device))
+ {
+ rt[from_device][mt].push_back(sender.value());
+ }
}
}
}