provide a little more fault-tolerance when input data is fishy
This commit is contained in:
parent
ac6583906d
commit
ed608f9f13
@ -148,13 +148,19 @@ NodeID readBinaryOSRMGraphFromStream(istream &in, vector<EdgeT>& edgeList, vecto
|
|||||||
// translate the external NodeIDs to internal IDs
|
// translate the external NodeIDs to internal IDs
|
||||||
ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(source);
|
ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(source);
|
||||||
if( ext2IntNodeMap.find(source) == ext2IntNodeMap.end()) {
|
if( ext2IntNodeMap.find(source) == ext2IntNodeMap.end()) {
|
||||||
cerr << "after " << edgeList.size() << " edges" << endl;
|
#ifndef NDEBUG
|
||||||
cerr << "->" << source << "," << target << "," << length << "," << dir << "," << weight << endl;
|
cerr << "[warning] unresolved source NodeID: " << source << endl;
|
||||||
cerr << "unresolved source NodeID: " << source << endl; exit(0);
|
#endif
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
source = intNodeID->second;
|
source = intNodeID->second;
|
||||||
intNodeID = ext2IntNodeMap.find(target);
|
intNodeID = ext2IntNodeMap.find(target);
|
||||||
if(ext2IntNodeMap.find(target) == ext2IntNodeMap.end()) { cerr << "unresolved target NodeID : " << target << endl; exit(0); }
|
if(ext2IntNodeMap.find(target) == ext2IntNodeMap.end()) {
|
||||||
|
#ifndef NDEBUG
|
||||||
|
cerr << "unresolved target NodeID : " << target << endl;
|
||||||
|
#endif
|
||||||
|
continue;
|
||||||
|
}
|
||||||
target = intNodeID->second;
|
target = intNodeID->second;
|
||||||
|
|
||||||
if(source == UINT_MAX || target == UINT_MAX) { cerr << "nonexisting source or target" << endl; exit(0); }
|
if(source == UINT_MAX || target == UINT_MAX) { cerr << "nonexisting source or target" << endl; exit(0); }
|
||||||
|
@ -251,7 +251,7 @@ int main (int argc, char *argv[]) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(edgeIT->target == nodesIT->id) {
|
if(edgeIT->target == nodesIT->id) {
|
||||||
if(edgeIT->startCoord.lat != INT_MIN) {
|
if(edgeIT->startCoord.lat != INT_MIN && edgeIT->startCoord.lon != INT_MIN) {
|
||||||
edgeIT->targetCoord.lat = nodesIT->lat;
|
edgeIT->targetCoord.lat = nodesIT->lat;
|
||||||
edgeIT->targetCoord.lon = nodesIT->lon;
|
edgeIT->targetCoord.lon = nodesIT->lon;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user