Skip to content

Commit

Permalink
fix potential NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
BasLeijdekkers committed May 5, 2016
1 parent 47e8323 commit a4f23fc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions utils/src/com/sixrr/metrics/utils/ClassUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ public static PsiPackage findPackage(PsiElement element) {
}
final PsiFile file = element.getContainingFile();
final PsiDirectory directory = file.getContainingDirectory();
if (directory == null) {
return null;
}
return JavaDirectoryService.getInstance().getPackage(directory);
}
}

0 comments on commit a4f23fc

Please sign in to comment.