0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

🐛 Fixed error from has helper w/o dependent data

no-issue

Usage of the has helper like `{{#has 'author:count>1'}}` when the
current context does not have the dependent data (in this case
`authors`) would error, because it could not read property length of
undefined.
This commit is contained in:
Fabien O'Carroll 2019-10-28 16:30:16 +07:00 committed by Kevin Ansfield
parent 953bd2a2fc
commit d78cbed84d

View file

@ -11,6 +11,9 @@ var proxy = require('./proxy'),
validAttrs = ['tag', 'author', 'slug', 'id', 'number', 'index', 'any', 'all'];
function handleCount(ctxAttr, data) {
if (!data || !_.isFinite(data.length)) {
return false;
}
let count;
if (ctxAttr.match(/count:\d+/)) {