Skip to content

Commit

Permalink
fix: missing items due to index '0' being falsy (#2176)
Browse files Browse the repository at this point in the history
  • Loading branch information
NigelBreslaw authored Jul 27, 2024
1 parent 548a586 commit 932b9b9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions native/app/store/Account/AccountSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -748,12 +748,12 @@ export function getItemDefinition(itemHash: ItemHash): DestinyItemDefinition {
return definitionItem;
}

if (itemDef?.i) {
if (itemDef.i !== undefined) {
const icon = Icons[itemDef.i];
definitionItem.icon = `${iconUrl}${icon}`;
}

if (itemDef?.itd) {
if (itemDef.itd !== undefined) {
definitionItem.itemTypeDisplayName = ItemTypeDisplayName[itemDef.itd]!;
definitionItem.search = `${definitionItem.itemTypeDisplayName.toLowerCase()} ${definitionItem.search}`;
}
Expand All @@ -762,7 +762,7 @@ export function getItemDefinition(itemHash: ItemHash): DestinyItemDefinition {
definitionItem.screenshot = `${screenshotUrl}${itemDef.s}`;
}

if (itemDef?.iw) {
if (itemDef.iw !== undefined) {
const waterMark = IconWaterMarks[itemDef.iw];
definitionItem.watermark = `${iconUrl}${waterMark}`;
}
Expand All @@ -775,7 +775,7 @@ export function getItemDefinition(itemHash: ItemHash): DestinyItemDefinition {
definitionItem.flavorText = itemDef.f;
}

if (itemDef?.d) {
if (itemDef.d !== undefined) {
definitionItem.description = Descriptions[itemDef.d] ?? "";
}

Expand Down Expand Up @@ -814,7 +814,7 @@ export function getItemDefinition(itemHash: ItemHash): DestinyItemDefinition {

const traitIds: string[] = [];
const traitDef = itemDef?.tI;
if (traitDef) {
if (traitDef !== undefined) {
for (const trait of traitDef) {
const traitIndex = trait;
const traitId = TraitIds[traitIndex]!;
Expand All @@ -826,11 +826,11 @@ export function getItemDefinition(itemHash: ItemHash): DestinyItemDefinition {
definitionItem.traitIds = traitIds;

const statGroupHashIndex = itemDef.st?.sgs;
if (statGroupHashIndex) {
if (statGroupHashIndex !== undefined) {
definitionItem.statGroupHash = StatGroupHash[statGroupHashIndex]!;
}
const bucketTypeIndex = itemDef.b;
if (bucketTypeIndex) {
if (bucketTypeIndex !== undefined) {
definitionItem.recoveryBucketHash = BucketTypeHashArray[bucketTypeIndex] ?? (0 as BucketHash);
}
definitionItem.name = itemDef?.n ?? "";
Expand Down

0 comments on commit 932b9b9

Please sign in to comment.