From 3f09a91147accf0d8d84cebaa0679674731e4e4a Mon Sep 17 00:00:00 2001 From: Jason Matthias Date: Thu, 13 Jun 2019 12:37:46 -0700 Subject: [PATCH] add logic to return error if index chosen for burst capture not valid expression type --- src/lib/calc-helpers.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/calc-helpers.js b/src/lib/calc-helpers.js index 57cda8c..635d988 100644 --- a/src/lib/calc-helpers.js +++ b/src/lib/calc-helpers.js @@ -27,10 +27,14 @@ export const getImageData = opts => */ const getExpByIndex = idx => calculator.getExpressions()[idx - 1]; -// Returns an error message on failure. +/** + * Returns an error message on failure. + * Skips expressions that are not of type 'expression' + */ export const setSliderByIndex = (idx, val) => { const exp = getExpByIndex(idx); if (!exp) return noSuchExpression(idx); + if (exp.type !== 'expression') return notASlider(idx); const { id, latex } = exp; const match = latex.match(/(.+)=/);