Skip to content

Commit 154632c

Browse files
committed
Allow null annotation elements (#1493)
* Allow annotations to not have a resolved element. * Revert errant model.dart change
1 parent 1b1ee38 commit 154632c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/src/model.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2096,7 +2096,8 @@ abstract class ModelElement extends Nameable
20962096
if (md == null) md = new List<dynamic>();
20972097
return md.map((dynamic a) {
20982098
String annotation = (const HtmlEscape()).convert(a.toSource());
2099-
var me = package.findCanonicalModelElementFor(a.element.enclosingElement);
2099+
// a.element can be null if the element can't be resolved.
2100+
var me = package.findCanonicalModelElementFor(a.element?.enclosingElement);
21002101
if (me != null)
21012102
annotation = annotation.replaceFirst(me.name, me.linkedName);
21022103
return annotation;

0 commit comments

Comments
 (0)