Skip to content

Commit

Permalink
fix: NullPointerException in MSBuildAnalyzer (#5589)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylong authored Mar 23, 2023
1 parent 743ccf5 commit 3a28284
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,15 @@ private Properties loadDirectoryBuildProps(File directory) throws MSBuildProject
}

final File directoryProps = locateDirectoryBuildFile(DIRECTORY_BUILDPROPS, directory);
final Map<String, String> entries = readDirectoryBuildProps(directoryProps);
if (directoryProps != null) {
final Map<String, String> entries = readDirectoryBuildProps(directoryProps);

for (Map.Entry<String, String> entry : entries.entrySet()) {
props.put(entry.getKey(), entry.getValue());
if (entries != null) {
for (Map.Entry<String, String> entry : entries.entrySet()) {
props.put(entry.getKey(), entry.getValue());
}
}
}

return props;
}

Expand Down Expand Up @@ -323,7 +326,7 @@ private Map<String, String> readDirectoryBuildProps(File directoryProps) throws

for (String importStatement : imports) {
final File parentBuildProps = getImport(importStatement, directoryProps);
if (!directoryProps.equals(parentBuildProps)) {
if (parentBuildProps != null && !directoryProps.equals(parentBuildProps)) {
final Map<String, String> parentEntries = readDirectoryBuildProps(parentBuildProps);
if (parentEntries != null) {
parentEntries.putAll(entries);
Expand Down

0 comments on commit 3a28284

Please sign in to comment.