diff options
author | Roel Spilker <r.spilker@gmail.com> | 2019-07-24 21:18:36 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2019-07-24 21:18:36 +0200 |
commit | 867c3caf61fcc76b7cb8a7356e71858889f85ebf (patch) | |
tree | 0a7aeea39790542b14e75585ae49974abcdf9d42 /src/core/lombok/javac | |
parent | 1f58c92e44b30aef9eac1b83753718a4c8fabbd0 (diff) | |
download | lombok-867c3caf61fcc76b7cb8a7356e71858889f85ebf.tar.gz lombok-867c3caf61fcc76b7cb8a7356e71858889f85ebf.tar.bz2 lombok-867c3caf61fcc76b7cb8a7356e71858889f85ebf.zip |
Fixes #2184: NPE on package-info.java without package declaration.
Diffstat (limited to 'src/core/lombok/javac')
-rw-r--r-- | src/core/lombok/javac/apt/LombokProcessor.java | 7 |
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(); |