JS: fix NPE

This commit is contained in:
Arthur Baars
2023-03-10 12:52:41 +01:00
parent 348165205c
commit 1a70297662

View File

@@ -1234,7 +1234,8 @@ protected DependencyInstallationResult preparePackagesAndDependencies(Set<Path>
ParseResultInfo loc = extractor.extract(f, state);
if (!extractor.getConfig().isExterns() && (loc == null || loc.getLinesOfCode() != 0)) seenCode = true;
if (!extractor.getConfig().isExterns()) seenFiles = true;
for (ParseError err : loc.getParseErrors()) {
List<ParseError> errors = loc == null ? Collections.emptyList() : loc.getParseErrors();
for (ParseError err : errors) {
String msg = "A parse error occurred: " + StringUtil.escapeMarkdown(err.getMessage())
+ ". Check the syntax of the file. If the file is invalid, correct the error or [exclude](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/customizing-code-scanning) the file from analysis.";
// file, relative to the source root