From d7f810ac748c0990e4dddb7d143d58f8d31b6bf2 Mon Sep 17 00:00:00 2001 From: Evgeni B <26095528+devgeni@users.noreply.github.com> Date: Fri, 25 Mar 2022 14:55:24 +0300 Subject: [PATCH] fix: catch evalSuffixExpr error --- src/core/cell.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/core/cell.js b/src/core/cell.js index 0c2b577a..1e9c8f62 100644 --- a/src/core/cell.js +++ b/src/core/cell.js @@ -208,12 +208,16 @@ const cellRender = (src, formulaMap, getCellText, cellList = []) => { if (src[0] === '=') { const stack = infixExprToSuffixExpr(src.substring(1)); if (stack.length <= 0) return src; - return evalSuffixExpr( - stack, - formulaMap, - (x, y) => cellRender(getCellText(x, y), formulaMap, getCellText, cellList), - cellList, - ); + try { + return evalSuffixExpr( + stack, + formulaMap, + (x, y) => cellRender(getCellText(x, y), formulaMap, getCellText, cellList), + cellList, + ); + } catch (err) { + return "Error! Invalid operation!"; + } } return src; };