Nullguard getMessageItemContents() when checking count of reward items

This commit is contained in:
Dev 2023-11-26 22:53:09 +00:00
parent 130f120fda
commit 14e917823c

View File

@ -219,8 +219,8 @@ export class DialogueHelper
}
// Check reward count when item being moved isn't in reward list
// if count is 0, it means after this move the reward array will be empty and all rewards collected
const rewardItemCount = message.items.data.filter((x) => x._id !== itemId);
// If count is 0, it means after this move the reward array will be empty and all rewards collected
const rewardItemCount = message.items.data?.filter((item) => item._id !== itemId);
if (rewardItemCount.length === 0)
{
message.rewardCollected = true;