From a4f94993059dc5120ce6296c42ef472a07111f2e Mon Sep 17 00:00:00 2001 From: Daniel Patterson Date: Sun, 4 Sep 2016 13:40:48 -0700 Subject: [PATCH] Invalid string values in lanes:psv:backward should result in 0 lanes, not `nil`. --- features/guidance/turn-lanes.feature | 18 ++++++++++++++++++ profiles/lib/guidance.lua | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/features/guidance/turn-lanes.feature b/features/guidance/turn-lanes.feature index 558b577b3..4bdd089e5 100644 --- a/features/guidance/turn-lanes.feature +++ b/features/guidance/turn-lanes.feature @@ -120,6 +120,24 @@ Feature: Turn Lane Guidance | a,d | road,turn,turn | depart,turn right,arrive | ,straight:false right:true, | | a,c | road,road | depart,arrive | , | + # This tests whether empty/invalid PSV tags cause osrm-extract to crash + @bug + Scenario: Turn with Bus-Lane + Given the node map + | a | | b | | c | + | | | | | | + | | | d | | | + + And the ways + | nodes | name | turn:lanes:forward | lanes:psv:forward | lanes:psv:backward | + | ab | road | through\|right\| | 1 | foo | + | bc | road | | | | + | bd | turn | | | | + + When I route I should get + | waypoints | route | turns | lanes | + | a,d | road,turn,turn | depart,turn right,arrive | ,straight:false right:true, | + @PROFILE @LANES Scenario: Turn with Bus-Lane but without lanes Given the node map diff --git a/profiles/lib/guidance.lua b/profiles/lib/guidance.lua index 3a4106eba..50ecf8fcb 100644 --- a/profiles/lib/guidance.lua +++ b/profiles/lib/guidance.lua @@ -84,7 +84,7 @@ local function get_psv_counts(way) if( psv_backward and psv_backward ~= "" ) then bw = tonumber(psv_backward); if( bw == nil ) then - fw = 0 + bw = 0 end end return fw, bw