Commit 94b9cc30 authored by Volker Krause's avatar Volker Krause
Browse files

Properly handle empty path sections in Hafas responses

parent 8cc4a70c
Pipeline #71465 passed with stage
in 21 seconds
......@@ -481,7 +481,7 @@ static std::vector<Path> parsePaths(const QJsonArray &polyL, const std::vector<L
// crdEncF: 1-dimensional, always 0?
std::vector<PathSection> sections;
sections.reserve(ppLocRefL.size() - 1);
sections.reserve(std::max(0, ppLocRefL.size() - 1));
int prevPpIdx = 0;
QPointF prevCoord;
for (const auto &ppLocRefV : ppLocRefL) {
......@@ -514,7 +514,9 @@ static std::vector<Path> parsePaths(const QJsonArray &polyL, const std::vector<L
}
Path path;
path.setSections(std::move(sections));
if (!sections.empty()) {
path.setSections(std::move(sections));
}
paths.push_back(std::move(path));
}
return paths;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment