aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2019-07-24 21:18:36 +0200
committerRoel Spilker <r.spilker@gmail.com>2019-07-24 21:18:36 +0200
commit867c3caf61fcc76b7cb8a7356e71858889f85ebf (patch)
tree0a7aeea39790542b14e75585ae49974abcdf9d42 /src
parent1f58c92e44b30aef9eac1b83753718a4c8fabbd0 (diff)
downloadlombok-867c3caf61fcc76b7cb8a7356e71858889f85ebf.tar.gz
lombok-867c3caf61fcc76b7cb8a7356e71858889f85ebf.tar.bz2
lombok-867c3caf61fcc76b7cb8a7356e71858889f85ebf.zip
Fixes #2184: NPE on package-info.java without package declaration.
Diffstat (limited to 'src')
-rw-r--r--src/core/lombok/javac/apt/LombokProcessor.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/lombok/javac/apt/LombokProcessor.java b/src/core/lombok/javac/apt/LombokProcessor.java
index 79db5dec..ed6cdb65 100644
--- a/src/core/lombok/javac/apt/LombokProcessor.java
+++ b/src/core/lombok/javac/apt/LombokProcessor.java
@@ -389,7 +389,12 @@ public class LombokProcessor extends AbstractProcessor {
}
private JCCompilationUnit toUnit(Element element) {
- TreePath path = trees == null ? null : trees.getPath(element);
+ TreePath path = null;
+ if (trees != null) {
+ try {
+ path = trees.getPath(element);
+ } catch (NullPointerException ignore) {}
+ }
if (path == null) return null;
return (JCCompilationUnit) path.getCompilationUnit();