Skip to content

Commit

Permalink
add logic to return error if index chosen for burst capture not valid…
Browse files Browse the repository at this point in the history
… expression type
  • Loading branch information
japamat committed Jun 13, 2019
1 parent 001c029 commit 3f09a91
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/calc-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(/(.+)=/);
Expand Down

0 comments on commit 3f09a91

Please sign in to comment.