eladnava/mailgen

Cannot read property 'button' of undefined

Closed this issue · 1 comments

Commit 4954057 introduced a bug when rendering the html. If no action is passed (or null), it will try to evaluate the element zero. Since we always convert the action to an array, even if it has zero elements (body.action = convertToArray(body.action)). Then the condition locals.action[0].button[0].fallback will try to access the first element of the action that doesn't exist.

HI @Guergeiro,
Thanks for identifying the issue and creating the PR.

It has been merged & published to npm in 2.0.27.