diff --git a/frontend/src/features/Vessel/components/VesselSidebar/Controls/LastControl.tsx b/frontend/src/features/Vessel/components/VesselSidebar/Controls/LastControl.tsx index 62e97a1aeb..7e69a22a78 100644 --- a/frontend/src/features/Vessel/components/VesselSidebar/Controls/LastControl.tsx +++ b/frontend/src/features/Vessel/components/VesselSidebar/Controls/LastControl.tsx @@ -13,8 +13,9 @@ type LastControlProps = { export function LastControl({ field }: LastControlProps) { const { control, text } = field const controlUnits = - control?.controlUnits.map(controlUnit => controlUnit.name.replace('(historique)', '')).join(', ') ?? - 'Unité manquante' + !!control && control.controlUnits.length > 0 + ? control.controlUnits.map(controlUnit => controlUnit.name.replace('(historique)', '')).join(', ') + : 'Unité manquante' const numberOfInfractions = useMemo(() => getNumberOfInfractions(control), [control])