diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b54c1ecb1..07be4bf7b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 5.2.1 + +* fix: avoid null check exception in the analyzer. + ## 5.2.0 * fix: remove recursive traversal for [`ban-name`](https://dartcodemetrics.dev/docs/rules/common/ban-name) rule. diff --git a/lib/src/analyzers/unused_code_analyzer/used_code_visitor.dart b/lib/src/analyzers/unused_code_analyzer/used_code_visitor.dart index a212062b47..19ae2823a9 100644 --- a/lib/src/analyzers/unused_code_analyzer/used_code_visitor.dart +++ b/lib/src/analyzers/unused_code_analyzer/used_code_visitor.dart @@ -157,7 +157,8 @@ class UsedCodeVisitor extends RecursiveAstVisitor { } bool _recordConditionalElement(Element element) { - final elementPath = element.source?.fullName; + // ignore: deprecated_member_use + final elementPath = element.enclosingElement3?.source?.fullName; if (elementPath == null) { return false; }