From dd5b80ab4ee9729ac3d12b85f2fa4517b8c2d6c9 Mon Sep 17 00:00:00 2001 From: mrv777 Date: Fri, 11 Oct 2024 17:42:24 -0500 Subject: [PATCH] fix: Handle when no default found --- src/lib/asicDefaults.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/asicDefaults.ts b/src/lib/asicDefaults.ts index 963bc3a..e5cf221 100644 --- a/src/lib/asicDefaults.ts +++ b/src/lib/asicDefaults.ts @@ -97,11 +97,11 @@ export const coreVoltageOptions: Record = { export function getDefaultFrequency(model: string): number { const options = frequencyOptions[model]; const defaultOption = options.find(option => option.name.includes('default')); - return defaultOption ? defaultOption.value : options[0].value; + return defaultOption ? defaultOption.value : options[0]?.value || 0; } export function getDefaultCoreVoltage(model: string): number { const options = coreVoltageOptions[model]; const defaultOption = options.find(option => option.name.includes('default')); - return defaultOption ? defaultOption.value : options[0].value; + return defaultOption ? defaultOption.value : options[0]?.value || 0; }