fix: code correctness, security, and simplicity improvements
This commit is contained in:
@@ -253,11 +253,11 @@ func (g *Graph) FindRoute(originID, destID string, opts SearchOptions) *Itinerar
|
||||
|
||||
newDurationWithMCT := newDuration + transferTime
|
||||
|
||||
// Check if we've visited this node with fewer or equal transfers
|
||||
// Check if we've visited this node with fewer transfers
|
||||
visKey := current.nodeID
|
||||
if existingTransfers, ok := visited[visKey]; ok {
|
||||
if current.transfers+1 >= existingTransfers {
|
||||
// Already visited this node with fewer or equal transfers, skip
|
||||
if current.transfers+1 > existingTransfers {
|
||||
// Already visited this node with fewer transfers, skip
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user