From 92e81f6c38c13ccca954b4e9fb0ff161b9102008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Wed, 20 Mar 2024 12:56:50 -0300 Subject: [PATCH] core: frontend: autopilot: parameter: Allow handling undefined cases by caller MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- core/frontend/src/types/autopilot/parameter.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/frontend/src/types/autopilot/parameter.ts b/core/frontend/src/types/autopilot/parameter.ts index 2a005ca63b..72c9460787 100644 --- a/core/frontend/src/types/autopilot/parameter.ts +++ b/core/frontend/src/types/autopilot/parameter.ts @@ -39,13 +39,12 @@ export default interface Parameter { units?: string } -export function printParam(param?: Parameter): string { +export function printParam(param: Parameter | undefined): string | undefined { if (param === undefined) { - return 'Unknown' + return undefined } - // Show device id as an hexadecimal value - if (param?.name.includes('_DEV_ID') || param?.name.includes('_DEVID')) { + if (param.name.includes('_DEV_ID') || param.name.includes('_DEVID')) { return `0x${param.value.toString(16).padStart(8, '0')}` }