Skip to content

Commit 39c22c5

Browse files
authored
Allow null annotation elements (#1493)
* Allow annotations to not have a resolved element. * Revert errant model.dart change
1 parent 704dc32 commit 39c22c5

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
@@ -2332,7 +2332,8 @@ abstract class ModelElement extends Nameable
23322332
if (md == null) md = new List<dynamic>();
23332333
return md.map((dynamic a) {
23342334
String annotation = (const HtmlEscape()).convert(a.toSource());
2335-
var me = package.findCanonicalModelElementFor(a.element.enclosingElement);
2335+
// a.element can be null if the element can't be resolved.
2336+
var me = package.findCanonicalModelElementFor(a.element?.enclosingElement);
23362337
if (me != null)
23372338
annotation = annotation.replaceFirst(me.name, me.linkedName);
23382339
return annotation;

0 commit comments

Comments
 (0)