diff --git a/org.lflang/src/org/lflang/cli/CliBase.java b/org.lflang/src/org/lflang/cli/CliBase.java index 77581a6410..d4dfe9c782 100644 --- a/org.lflang/src/org/lflang/cli/CliBase.java +++ b/org.lflang/src/org/lflang/cli/CliBase.java @@ -207,26 +207,29 @@ public void validateResource(Resource resource) { assert resource != null; List issues = this.validator.validate( - resource, CheckMode.ALL, CancelIndicator.NullImpl); + resource, CheckMode.ALL, CancelIndicator.NullImpl); for (Issue issue : issues) { // Issues may also relate to imported resources. - URI uri = issue.getUriToProblem(); - try { - issueCollector.accept( - new LfIssue( - issue.getMessage(), - issue.getSeverity(), - issue.getLineNumber(), - issue.getColumn(), - issue.getLineNumberEnd(), - issue.getColumnEnd(), - issue.getLength(), - FileUtil.toPath(uri))); - } catch (IOException e) { - reporter.printError( - "Unable to convert '" + uri + "' to path." + e); + URI uri = issue.getUriToProblem(); + Path path = null; + if (uri != null) { + try { + path = FileUtil.toPath(uri); + } catch (IOException e) { + reporter.printError("Unable to convert '" + uri + "' to path." + e); + } } + issueCollector.accept( + new LfIssue( + issue.getMessage(), + issue.getSeverity(), + issue.getLineNumber(), + issue.getColumn(), + issue.getLineNumberEnd(), + issue.getColumnEnd(), + issue.getLength(), + path)); } }