Skip to content

Commit

Permalink
Merge pull request #7 from MiRON-project/fix_int_double_output
Browse files Browse the repository at this point in the history
fix ambiguous conversion
  • Loading branch information
renan028 authored Jul 10, 2020
2 parents 721364e + df68516 commit 37d9db8
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions Executor/src/skill_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,33 @@ BT::NodeStatus SkillAction::convertResultToStatus(const std::string &result_stri
const auto &output = json["outputs"];
for (auto it = output.begin(); it != output.end(); it++)
{

if (it.value().is_boolean())
setOutput(it.key(), it.value().get<bool>());
else if (it.value().is_number_integer())
setOutput(it.key(), it.value().get<int>());
else if (it.value().is_number_float())
setOutput(it.key(), it.value().get<double>());
else if (it.value().is_number_float()) {
try {
setOutput(it.key(), it.value().get<double>());
continue;
}
catch (...){};
try {
setOutput(it.key(), it.value().get<float>());
continue;
}
catch (...){};
}
else if (it.value().is_number_integer()) {
try {
setOutput(it.key(), it.value().get<int>());
continue;
}
catch (...){};
try {
setOutput(it.key(), it.value().get<double>());
continue;
}
catch (...){};
}
else if (it.value().is_string())
setOutput(it.key(), it.value().get<std::string>());
else
Expand Down

0 comments on commit 37d9db8

Please sign in to comment.