Skip to content

Commit 67de571

Browse files
committed
Fix a content parsing bug.
Signed-off-by: Zixuan James Li <[email protected]>
1 parent e91694f commit 67de571

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/model/content.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -990,14 +990,14 @@ class _ZulipContentParser {
990990
if (child is! dom.Element) return null;
991991
if (child.localName != 'pre') return null;
992992

993-
if (child.nodes.length > 2) return null;
993+
if (child.nodes.length > 2 || child.nodes.isEmpty) return null;
994994
if (child.nodes.length == 2) {
995995
final first = child.nodes[0];
996996
if (first is! dom.Element
997997
|| first.localName != 'span'
998998
|| first.nodes.isNotEmpty) return null;
999999
}
1000-
final grandchild = child.nodes[child.nodes.length - 1];
1000+
final grandchild = child.nodes.last
10011001
if (grandchild is! dom.Element) return null;
10021002
if (grandchild.localName != 'code') return null;
10031003

0 commit comments

Comments
 (0)