Skip to content

Commit 1ca5f0d

Browse files
committed
Ensure a customRender that returns null falls back on the default behaviour
1 parent fbaa7ba commit 1ca5f0d

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

lib/html_parser.dart

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -258,16 +258,18 @@ class HtmlParser extends StatelessWidget {
258258
tree.element,
259259
);
260260
assert(render is InlineSpan || render is Widget);
261-
return render is InlineSpan
262-
? render
263-
: WidgetSpan(
264-
child: ContainerSpan(
265-
newContext: newContext,
266-
style: tree.style,
267-
shrinkWrap: context.parser.shrinkWrap,
268-
child: render,
269-
),
270-
);
261+
if (render != null) {
262+
return render is InlineSpan
263+
? render
264+
: WidgetSpan(
265+
child: ContainerSpan(
266+
newContext: newContext,
267+
style: tree.style,
268+
shrinkWrap: context.parser.shrinkWrap,
269+
child: render,
270+
),
271+
);
272+
}
271273
}
272274

273275
//Return the correct InlineSpan based on the element type.

0 commit comments

Comments
 (0)