From 3b8a2d8f4bb41994f3a1f63172748f873a73d4f1 Mon Sep 17 00:00:00 2001 From: Suherdy Yacob Date: Fri, 29 May 2026 16:37:20 +0700 Subject: [PATCH] fix: add null checks for reward object in pos_order_patch to prevent runtime errors --- static/src/app/pos_order_patch.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/src/app/pos_order_patch.js b/static/src/app/pos_order_patch.js index e046c65..cadaf6b 100644 --- a/static/src/app/pos_order_patch.js +++ b/static/src/app/pos_order_patch.js @@ -18,7 +18,7 @@ patch(PosOrder.prototype, { for (const rule of program.rule_ids) { for (const line of rewardLines) { const reward = line.reward_id; - if (this._validForPointsCorrection(reward, line, rule)) { + if (reward && this._validForPointsCorrection(reward, line, rule)) { if (rule.reward_point_mode === "money") { const priceToUse = rule.money_reward_point_mode === "before_tax" ? line.prices.total_excluded @@ -124,6 +124,7 @@ patch(PosOrder.prototype, { if (line.is_reward_line) { const reward = line.reward_id; if ( + !reward || program.id === reward.program_id?.id || ["gift_card", "ewallet"].includes(reward.program_id?.program_type) ) {