diff --git a/src/lib/core/handlers/sheetNotiHandler.ts b/src/lib/core/handlers/sheetNotiHandler.ts index bfcec2f..f3c95fa 100644 --- a/src/lib/core/handlers/sheetNotiHandler.ts +++ b/src/lib/core/handlers/sheetNotiHandler.ts @@ -51,14 +51,19 @@ export function handleSheetResponseFromNoti(raw_payload: any, ref: string, count // price idx should be last let price_idx = header_idx[header_idx.length - 1]; let price_rows = c.payload; + if (!price_rows) { + continue; + } // get last because last row will always override let expected_row = price_rows[price_rows.length - 1]; - if (expected_row.cells != undefined) { + if (expected_row != undefined && expected_row.cells != undefined) { let price_col = expected_row.cells[price_idx]; products[curr_product_code] = price_col; console.log(`[handleSheetPrice][country] ${curr_product_code} --> ${price_col}`); } else { - console.log(`[handleSheetPrice][country] ${curr_product_code} not found cell`); + console.log( + `[handleSheetPrice][country] ${curr_product_code} not found cell, ${JSON.stringify(price_rows)}` + ); } }