diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts
index 443af533..63ac828b 100644
--- a/src/compiler/parser.ts
+++ b/src/compiler/parser.ts
@@ -639,10 +639,7 @@ function parseTIf(node: Element, ctx: ParsingContext): AST | null {
}
const condition = node.getAttribute("t-if")!;
node.removeAttribute("t-if");
- const content = parseNode(node, ctx);
- if (!content) {
- throw new Error("hmmm");
- }
+ const content = parseNode(node, ctx) || { type: ASTType.Text, value: "" };
let nextElement = node.nextElementSibling;
// t-elifs
diff --git a/tests/compiler/__snapshots__/t_if.test.ts.snap b/tests/compiler/__snapshots__/t_if.test.ts.snap
index f69bec38..202e852b 100644
--- a/tests/compiler/__snapshots__/t_if.test.ts.snap
+++ b/tests/compiler/__snapshots__/t_if.test.ts.snap
@@ -384,6 +384,23 @@ exports[`t-if t-if in a t-if 1`] = `
}"
`;
+exports[`t-if t-if with empty content 1`] = `
+"function anonymous(bdom, helpers
+) {
+ let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
+ let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers;
+
+ return function template(ctx, node, key = \\"\\") {
+ let b2,b3;
+ b2 = text(\`hello\`);
+ if (ctx['condition']) {
+ b3 = text(\`\`);
+ }
+ return multi([b2, b3]);
+ }
+}"
+`;
+
exports[`t-if t-if/t-else with more content 1`] = `
"function anonymous(bdom, helpers
) {
diff --git a/tests/compiler/parser.test.ts b/tests/compiler/parser.test.ts
index 39f6dc94..9f1d102a 100644
--- a/tests/compiler/parser.test.ts
+++ b/tests/compiler/parser.test.ts
@@ -395,6 +395,19 @@ describe("qweb parser", () => {
});
});
+ test("t-if with empty content", async () => {
+ expect(parse(`