aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZog2018-05-28 09:55:15 +0200
committerJohan Van Ryseghem2018-05-28 10:30:17 +0200
commit72f9cc6d810fd2a2226e9b1f0c74b8fbfbb2811c (patch)
tree9a55e996bcd76fcee111c69abeb8476dbd9f98f7
parentc1ebc713fd0eb4692d679fc80e184cb802c98602 (diff)
downloadchouette-core-72f9cc6d810fd2a2226e9b1f0c74b8fbfbb2811c.tar.bz2
Refs #7193; Protect calls to RouteWayCost
-rw-r--r--app/workers/route_way_cost_worker.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/workers/route_way_cost_worker.rb b/app/workers/route_way_cost_worker.rb
index b62416c3d..5d8ed52f9 100644
--- a/app/workers/route_way_cost_worker.rb
+++ b/app/workers/route_way_cost_worker.rb
@@ -3,7 +3,11 @@ class RouteWayCostWorker
def perform(referential_id, route_id)
Referential.find(referential_id).switch
- route = Chouette::Route.find(route_id)
+ route = Chouette::Route.where(id: route_id).last
+ unless route.present?
+ Rails.logger.warn "RouteWayCost called on missing route ##{route_id}".red
+ return
+ end
# Prevent recursive worker spawning since this call updates the
# `costs` field of the route.