mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-05 10:59:47 -05:00
Bad payload handling
This commit is contained in:
@@ -115,7 +115,13 @@ bool FlightControllerTopic::isDone() const {
|
||||
}
|
||||
|
||||
void FlightControllerTopic::handleJson(const nlohmann::json& json) {
|
||||
switch (CommandMap.at(json[TypeKey])) {
|
||||
auto it = CommandMap.find(json[TypeKey]);
|
||||
if (it == CommandMap.end()) {
|
||||
LWARNING(fmt::format("Poorly formatted JSON command: no '{}' in payload", TypeKey));
|
||||
return;
|
||||
}
|
||||
|
||||
switch (it->second) {
|
||||
case Command::Connect:
|
||||
connect();
|
||||
break;
|
||||
@@ -126,7 +132,7 @@ void FlightControllerTopic::handleJson(const nlohmann::json& json) {
|
||||
processInputState(json);
|
||||
break;
|
||||
default:
|
||||
LWARNING(fmt::format("Unrecognized action: {}", json[TypeKey]));
|
||||
LWARNING(fmt::format("Unrecognized action: {}", it->first));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user