Skip to content

Commit

Permalink
fix: Crash on missing DestinyStatDefinition (#2082)
Browse files Browse the repository at this point in the history
  • Loading branch information
NigelBreslaw authored Jul 19, 2024
1 parent 04e088e commit 6b627f5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions native/app/inventory/pages/details/ScreenInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 "";
}
Expand Down
2 changes: 1 addition & 1 deletion native/app/stats/StatBars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ function getName(statType: StatType) {
case StatType.Separator:
return "";
default:
return DestinyStatDefinition[statType]?.displayProperties.name ?? "";
return DestinyStatDefinition?.[statType]?.displayProperties.name ?? "";
}
}

Expand Down
2 changes: 1 addition & 1 deletion native/app/utilities/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6b627f5

Please sign in to comment.