Skip to content

Commit daf5b6f

Browse files
authored
Fix a crash when using --no-generate-docs (#2137)
* Fix a crash when using --no-generate-docs * Move check to _parseDocumentation
1 parent f8ccff0 commit daf5b6f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/src/model/documentation.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ class Documentation {
6565

6666
/// Returns a tuple of List<md.Node> and hasExtendedDocs
6767
Tuple2<List<md.Node>, bool> _parseDocumentation(bool processFullDocs) {
68+
if (!_element.hasDocumentation) {
69+
return Tuple2([], false);
70+
}
6871
String text = _element.documentation;
6972
showWarningsForGenericsOutsideSquareBracketsBlocks(text, _element);
7073
MarkdownDocument document =

lib/src/render/documentation_renderer.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ abstract class DocumentationRenderer {
1313
class DocumentationRendererHtml extends DocumentationRenderer {
1414
@override
1515
Tuple2<String, String> render(List<md.Node> nodes, bool processFullDocs) {
16+
if (nodes.isEmpty) {
17+
return Tuple2('', '');
18+
}
1619
var rawHtml = md.HtmlRenderer().render(nodes);
1720
var asHtmlDocument = parse(rawHtml);
1821
for (var s in asHtmlDocument.querySelectorAll('script')) {

0 commit comments

Comments
 (0)