Skip to content

Commit

Permalink
Merge pull request #356 from DendoD96/mnc_fix
Browse files Browse the repository at this point in the history
Quick solution for mnc values bug
  • Loading branch information
aligungr authored Jul 1, 2021
2 parents 9c84f27 + d5bcb6c commit 8f55d2c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/utils/yaml_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ void AssertHasFields(const YAML::Node &node, const std::vector<std::string> &fie

int GetInt32(const YAML::Node &node, const std::string &name)
{
AssertHasInt32(node, name);
return node[name].as<int>();
auto nodeValue = node[name].Scalar();
nodeValue.erase(0, std::min(nodeValue.find_first_not_of('0'), nodeValue.size()-1));
YAML::Node modifiedNode;
modifiedNode[name] = nodeValue;
AssertHasInt32(modifiedNode, name);
return modifiedNode[name].as<int>();
}

int GetInt32(const YAML::Node &node, const std::string &name, std::optional<int> minValue, std::optional<int> maxValue)
Expand Down

0 comments on commit 8f55d2c

Please sign in to comment.