From 00561999ecfa3685448978ba97376daefdc9430e Mon Sep 17 00:00:00 2001 From: Eric Leroy-Terquem Date: Tue, 23 May 2023 15:52:51 +0200 Subject: [PATCH] fix(type de champ): do not raise error if tdc already destroyed --- app/controllers/administrateurs/types_de_champ_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/administrateurs/types_de_champ_controller.rb b/app/controllers/administrateurs/types_de_champ_controller.rb index 05dea205a..1861e78f0 100644 --- a/app/controllers/administrateurs/types_de_champ_controller.rb +++ b/app/controllers/administrateurs/types_de_champ_controller.rb @@ -74,7 +74,7 @@ module Administrateurs def destroy coordinate, type_de_champ = draft.coordinate_and_tdc(params[:stable_id]) - if coordinate.used_by_routing_rules? + if coordinate&.used_by_routing_rules? errors = "« #{type_de_champ.libelle} » est utilisé pour le routage, vous ne pouvez pas le supprimer." @morphed = [champ_component_from(coordinate, focused: false, errors:)] flash.alert = errors