File tree 2 files changed +9
-2
lines changed
2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ class _RelativeLinkSyntax extends m.LinkSyntax {
42
42
@override
43
43
m.Link getLink (m.InlineParser parser, Match match, m.TagState state) {
44
44
final m.Link link = super .getLink (parser, match, state);
45
- if (_isRelativePathUrl (link.url)) {
45
+ if (link != null && _isRelativePathUrl (link.url)) {
46
46
final Uri newUri = new Uri (
47
47
scheme: baseUri.scheme,
48
48
host: baseUri.host,
@@ -56,7 +56,7 @@ class _RelativeLinkSyntax extends m.LinkSyntax {
56
56
}
57
57
58
58
bool _isRelativePathUrl (String url) =>
59
- ! url.startsWith ('#' ) && ! url.contains (':' );
59
+ url != null && ! url.startsWith ('#' ) && ! url.contains (':' );
60
60
}
61
61
62
62
m.ExtensionSet _createCustomExtension (String baseUrl) {
Original file line number Diff line number Diff line change @@ -74,4 +74,11 @@ void main() {
74
74
'<p><a href="README.md">text</a></p>\n ' );
75
75
});
76
76
});
77
+
78
+ group ('Bad markdown' , () {
79
+ test ('bad link' , () {
80
+ expect (markdownToHtml ('[a][b]' , 'http://www.example.com/' ),
81
+ '<p>[a][b]</p>\n ' );
82
+ });
83
+ });
77
84
}
You can’t perform that action at this time.
0 commit comments