Commit 9ab079fc authored by Volker Krause's avatar Volker Krause
Browse files

Improve handling of missing Hafas product modes

parent e41efa70
......@@ -22,9 +22,10 @@ void HafasBackend::setProductsMap(const QJsonArray& array)
for (const auto &prodV : array) {
const auto prodObj = prodV.toObject();
const auto bitmasks = prodObj.value(QLatin1String("bitmasks")).toArray();
const auto mode = static_cast<Line::Mode>(me.keyToValue(prodObj.value(QLatin1String("mode")).toString().toUtf8().constData()));
if (mode == Line::Unknown) {
auto mode = static_cast<Line::Mode>(me.keyToValue(prodObj.value(QLatin1String("mode")).toString().toUtf8().constData()));
if (mode == Line::Unknown || mode < 0) {
qCWarning(Log) << "Invalid product mode:" << prodObj;
mode = Line::Unknown;
}
for (const auto &bit : bitmasks) {
m_lineModeMap[bit.toInt()] = mode;
......
......@@ -171,6 +171,7 @@
1024
],
"id": "ferry",
"mode": "Ferry",
"name": "Fähre"
}
],
......
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