Skip to content

Commit 3e1837e

Browse files
authored
Fix null reference error in lint command (#6202)
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
1 parent 0f92282 commit 3e1837e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modules/nextflow/src/main/groovy/nextflow/cli/CmdLint.groovy

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ class CmdLint extends CmdBase {
201201
private void printErrors(SourceUnit source) {
202202
errorListener.beforeErrors()
203203

204-
source.getErrorCollector().getErrors().stream()
204+
final errors = source.getErrorCollector().getErrors() ?: []
205+
errors.stream()
205206
.filter(message -> message instanceof SyntaxErrorMessage)
206207
.map(message -> ((SyntaxErrorMessage) message).getCause())
207208
.sorted(ERROR_COMPARATOR)
@@ -210,7 +211,8 @@ class CmdLint extends CmdBase {
210211
summary.errors += 1
211212
})
212213

213-
source.getErrorCollector().getWarnings().stream()
214+
final warnings = source.getErrorCollector().getWarnings() ?: []
215+
warnings.stream()
214216
.filter(warning -> warning !instanceof ParanoidWarning)
215217
.sorted(WARNING_COMPARATOR)
216218
.forEach((warning) -> {

0 commit comments

Comments
 (0)