mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
throw qweb error if invalid loop in t-foreach
This commit is contained in:
@@ -644,6 +644,9 @@ const forEachDirective: Directive = {
|
||||
const name = node.getAttribute("t-as")!;
|
||||
let arrayID = ctx.generateID();
|
||||
ctx.addLine(`let _${arrayID} = ${qweb._formatExpression(elems)};`);
|
||||
ctx.addLine(
|
||||
`if (!_${arrayID}) { throw new Error('QWeb error: Invalid loop expression')}`
|
||||
);
|
||||
ctx.addLine(
|
||||
`if (typeof _${arrayID} === 'number') { _${arrayID} = Array.from(Array(_${arrayID}).keys())}`
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user