From 6b627f5aae0be3dc7a978e14c90eeffb139436dc Mon Sep 17 00:00:00 2001 From: Nigel Breslaw Date: Fri, 19 Jul 2024 19:16:23 +0200 Subject: [PATCH] fix: Crash on missing DestinyStatDefinition (#2082) --- native/app/inventory/pages/details/ScreenInfo.tsx | 4 ++-- native/app/stats/StatBars.tsx | 2 +- native/app/utilities/Constants.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/native/app/inventory/pages/details/ScreenInfo.tsx b/native/app/inventory/pages/details/ScreenInfo.tsx index 884bfff96..dcc5af182 100644 --- a/native/app/inventory/pages/details/ScreenInfo.tsx +++ b/native/app/inventory/pages/details/ScreenInfo.tsx @@ -120,10 +120,10 @@ export default function ScreenInfo({ destinyItem }: Props) { function getPrimaryStatLabel(destinyItem: DestinyItem): string { if (destinyItem.def.itemType === ItemType.Weapon) { - return DestinyStatDefinition[StatType.Power]?.displayProperties.name ?? ""; + return DestinyStatDefinition?.[StatType.Power]?.displayProperties.name ?? ""; } if (destinyItem.def.itemType === ItemType.Vehicle) { - return DestinyStatDefinition[StatType.Speed]?.displayProperties.name ?? ""; + return DestinyStatDefinition?.[StatType.Speed]?.displayProperties.name ?? ""; } return ""; } diff --git a/native/app/stats/StatBars.tsx b/native/app/stats/StatBars.tsx index 9c5fb8b99..59cb1cb33 100644 --- a/native/app/stats/StatBars.tsx +++ b/native/app/stats/StatBars.tsx @@ -201,7 +201,7 @@ function getName(statType: StatType) { case StatType.Separator: return ""; default: - return DestinyStatDefinition[statType]?.displayProperties.name ?? ""; + return DestinyStatDefinition?.[statType]?.displayProperties.name ?? ""; } } diff --git a/native/app/utilities/Constants.ts b/native/app/utilities/Constants.ts index b2acc9c3b..b3651ab6d 100644 --- a/native/app/utilities/Constants.ts +++ b/native/app/utilities/Constants.ts @@ -12,7 +12,7 @@ export function updateBucketSizes() { } export function updateDestinyText() { - DESTINY_TEXT.POWER = DestinyStatDefinition[1935470627]?.displayProperties.name ?? ""; + DESTINY_TEXT.POWER = DestinyStatDefinition?.[1935470627]?.displayProperties.name ?? ""; } export const VAULT_CHARACTER_ID = "VAULT" as CharacterId;