diff --git a/idea/resources/META-INF/plugin.xml b/idea/resources/META-INF/plugin.xml index eb499ab..20e278c 100644 --- a/idea/resources/META-INF/plugin.xml +++ b/idea/resources/META-INF/plugin.xml @@ -31,7 +31,7 @@ com.intellij.modules.platform diff --git a/idea/source/net/auoeke/uncheck/intellij/HighlightFilter.java b/idea/source/net/auoeke/uncheck/intellij/HighlightFilter.java index 4e21a2d..3daec32 100644 --- a/idea/source/net/auoeke/uncheck/intellij/HighlightFilter.java +++ b/idea/source/net/auoeke/uncheck/intellij/HighlightFilter.java @@ -81,14 +81,12 @@ private static boolean matches(HighlightInfo info, String key, String... argumen } private static boolean initialized(PsiMethod constructor, PsiField field) { - var body = constructor.getBody(); - - if (body == null) { + if (constructor == null || constructor.getBody() == null) { return false; } - return HighlightControlFlowUtil.variableDefinitelyAssignedIn(field, body) - || Stream.of(body.getChildren()) + return HighlightControlFlowUtil.variableDefinitelyAssignedIn(field, constructor.getBody()) + || Stream.of(constructor.getBody().getChildren()) .filter(PsiExpressionStatement.class::isInstance) .map(statement -> ((PsiExpressionStatement) statement).getExpression()) .anyMatch(expression -> expression instanceof PsiMethodCallExpression && initialized(((PsiMethodCallExpression) expression).resolveMethod(), field));