diff options
| author | Zog | 2018-05-28 09:55:15 +0200 |
|---|---|---|
| committer | Johan Van Ryseghem | 2018-05-28 10:30:17 +0200 |
| commit | 72f9cc6d810fd2a2226e9b1f0c74b8fbfbb2811c (patch) | |
| tree | 9a55e996bcd76fcee111c69abeb8476dbd9f98f7 | |
| parent | c1ebc713fd0eb4692d679fc80e184cb802c98602 (diff) | |
| download | chouette-core-72f9cc6d810fd2a2226e9b1f0c74b8fbfbb2811c.tar.bz2 | |
Refs #7193; Protect calls to RouteWayCost
| -rw-r--r-- | app/workers/route_way_cost_worker.rb | 6 |
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. |
