From 36ec24f02373e35f9e755b10e45d7bbc04894c53 Mon Sep 17 00:00:00 2001 From: Muhammad Eko Prasetyo Date: Wed, 4 May 2022 05:44:46 +0700 Subject: [PATCH] fix undefined --- src/components/pages/Artifacts.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/pages/Artifacts.tsx b/src/components/pages/Artifacts.tsx index fae11da..f23a08b 100644 --- a/src/components/pages/Artifacts.tsx +++ b/src/components/pages/Artifacts.tsx @@ -86,10 +86,15 @@ export default function Artifacts() { }; const getPercent = (affix:IReliquaryAffix)=>{ - if (affix.PropType.indexOf("PERCENT") !== -1 || affix.PropType.indexOf("CRITICAL") !== -1 || affix.PropType.indexOf("EFFICIENCY") !== -1 || affix.PropType.indexOf("HURT") !== -1) { - return parseFloat(String(affix.PropValue*100)).toPrecision(3) + "%"; + try{ + if (affix.PropType.indexOf("PERCENT") !== -1 || affix.PropType.indexOf("CRITICAL") !== -1 || affix.PropType.indexOf("EFFICIENCY") !== -1 || affix.PropType.indexOf("HURT") !== -1) { + return parseFloat(String(affix.PropValue*100)).toPrecision(3) + "%"; + } + return parseInt(String(affix.PropValue)); + }catch (e) { + console.log(e); + return parseInt(String(affix.PropValue)); } - return parseInt(String(affix.PropValue)); }; const handleGeneratedArtifact = () => {