Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle unsanitized data (closes #12) #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 5/21/truck-soft/car.lua
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ function process_node(profile, node, result, relations)
local restricted_by_height = false
if barrier == 'height_restrictor' then
local maxheight = Measure.get_max_height(node:get_value_by_key("maxheight"), node)
restricted_by_height = maxheight and maxheight < profile.vehicle_height
restricted_by_height = maxheight and tonumber(maxheight) and tonumber(maxheight) < profile.vehicle_height
end

-- make an exception for rising bollard barriers
Expand Down
4 changes: 2 additions & 2 deletions 5/21/truck-soft/lib/way_handlers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -480,11 +480,11 @@ function WayHandlers.handle_height(profile,way,result,data)
forward = Measure.get_max_height(forward,way)
backward = Measure.get_max_height(backward,way)

if forward and forward < profile.vehicle_height then
if forward and tonumber(forward) and tonumber(forward) < profile.vehicle_height then
result.forward_mode = mode.inaccessible
end

if backward and backward < profile.vehicle_height then
if backward and tonumber(backward) and tonumber(backward) < profile.vehicle_height then
result.backward_mode = mode.inaccessible
end
end
Expand Down