Skip to content

Commit 97038d8

Browse files
committed
fix: add explicit null check
1 parent f1f9170 commit 97038d8

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
@@ -331,7 +331,12 @@ class AvoidUsingApiLinter {
331331
return;
332332
}
333333

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

0 commit comments

Comments
 (0)