diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/errorhandling/TryWithIdenticalCatchesInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/errorhandling/TryWithIdenticalCatchesInspection.java index 574eb4d1320e..ad19aaa6dae0 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/errorhandling/TryWithIdenticalCatchesInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/errorhandling/TryWithIdenticalCatchesInspection.java @@ -84,11 +84,14 @@ public class TryWithIdenticalCatchesInspection extends BaseInspection { boolean[] duplicates = new boolean[catchSections.length]; for (int i = 0; i < catchSections.length; i++) { if (duplicates[i]) continue; - InputVariables inputVariables = new InputVariables(Collections.singletonList(catchSections[i].getParameter()), + final PsiCatchSection catchSection = catchSections[i]; + final PsiCodeBlock catchBlock = catchSection.getCatchBlock(); + if (catchBlock == null) continue; + InputVariables inputVariables = new InputVariables(Collections.singletonList(catchSection.getParameter()), statement.getProject(), - new LocalSearchScope(catchSections[i].getCatchBlock()), + new LocalSearchScope(catchBlock), false); - DuplicatesFinder finder = new DuplicatesFinder(new PsiElement[] { catchSections [i].getCatchBlock() }, + DuplicatesFinder finder = new DuplicatesFinder(new PsiElement[] {catchBlock}, inputVariables, null, Collections.emptyList()); for (int j = 0; j < catchSections.length; j++) { if (i == j || duplicates[j]) continue;