Skip to content

Commit fb60e35

Browse files
committed
missed two spots with hasvaluenotnull
1 parent df2c5f4 commit fb60e35

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/world/items/item-container.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class ItemContainer {
5555
for (let i = 0; i < this.size; i++) {
5656
const item = this.items[i];
5757

58-
if (item && item.itemId === search) {
58+
if (hasValueNotNull(item) && item.itemId === search) {
5959
slots.push(i);
6060
}
6161
}
@@ -66,7 +66,7 @@ export class ItemContainer {
6666

6767
public findIndex(item: number | Item): number {
6868
const itemId = (typeof item === 'number') ? item : item.itemId;
69-
return this._items.findIndex(i => i && i.itemId === itemId);
69+
return this._items.findIndex(i => hasValueNotNull(i) && i.itemId === itemId);
7070
}
7171

7272
public setAll(items: Item[], fireEvent: boolean = true): void {
@@ -88,7 +88,7 @@ export class ItemContainer {
8888

8989
public findItemIndex(item: Item): number {
9090
for (let i = 0; i < this._size; i++) {
91-
if (this._items[i] &&
91+
if (hasValueNotNull(this._items[i]) &&
9292
this._items[i].itemId === item.itemId &&
9393
this._items[i].amount >= item.amount) {
9494
return i;

0 commit comments

Comments
 (0)