Skip to content

Commit f0401e4

Browse files
committed
fix: add explicit null check
1 parent 2e3a597 commit f0401e4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/src/lints/avoid_using_api/avoid_using_api_linter.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,12 @@ class AvoidUsingApiLinter {
332332
return;
333333
}
334334

335-
final sourcePath = enclosingElement.library2?.uri.toString() ?? '';
335+
final libSource = enclosingElement.library2;
336+
if (libSource == null) {
337+
return;
338+
}
339+
340+
final sourcePath = libSource.uri.toString();
336341
if (!_matchesSource(sourcePath, source)) {
337342
return;
338343
}

0 commit comments

Comments
 (0)