Return a valid route even if nameIDs are bogus

This commit is contained in:
Dennis Luxen
2011-04-21 09:26:32 +00:00
parent 2c6e68dda7
commit 1f7ddc865f
2 changed files with 54 additions and 40 deletions
+7 -2
View File
@@ -26,6 +26,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include "BinaryHeap.h"
#include "PhantomNodes.h"
#include "../Util/StrIngUtil.h"
#include "../typedefs.h"
struct _HeapData {
@@ -294,8 +295,12 @@ public:
return ed.distance;
}
inline std::string& GetNameForNameID(const NodeID nameID) const {
return _names->at(nameID);
inline std::string &GetNameForNameID(const NodeID nameID) const {
return (nameID >= names->size() ? _names->at(0) : _names->at(nameID) );
}
inline std::string GetEscapedNameForNameID(const NodeID nameID) const {
return (nameID >= names->size() ? _names->at(0) : replaceAll(_names->at(nameID), "\"", "\\\"") );
}
inline short GetTypeOfEdgeForOriginDestinationNodeID(NodeID s, NodeID t) const {