Skip to content
Snippets Groups Projects
Verified Commit b649ddbe authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Fix exception when parsing invalid version

parent 6b522aee
No related branches found
No related tags found
No related merge requests found
Pipeline #2700 failed
......@@ -4,8 +4,6 @@
#include <nlohmann/json.hpp>
const static std::regex VERSION_REGEX(R"(r(\d+)\.(\d+)\.(\d+))");
namespace mtx {
namespace responses {
......@@ -15,7 +13,7 @@ from_json(const nlohmann::json &obj, Versions &response)
response.versions = obj.at("versions").get<std::vector<std::string>>();
for (auto &version : response.versions) {
if (!std::regex_match(version, VERSION_REGEX))
if (version.empty())
throw std::invalid_argument(version + ": invalid version");
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment