Skip to content

Commit

Permalink
fix(npe): Fixes an NPE when no overrides are set
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmcintosh committed Sep 28, 2023
1 parent 70a06b0 commit 184eeaa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public BakeRecipe buildCommand(
}

Map<String, Object> overrides = request.getOverrides();
if (!overrides.isEmpty()) {
if (overrides != null && !overrides.isEmpty()) {
List<String> overrideList = new ArrayList<>();
for (Map.Entry<String, Object> entry : overrides.entrySet()) {
overrideList.add(entry.getKey() + "=" + entry.getValue().toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ public void nullReferenceTest() throws IOException {
}
}

@Test
public void realNullReferenceOfOverrides() throws IOException {
bakeManifestRequest.setOverrides(null);

try (BakeManifestEnvironment env = BakeManifestEnvironment.create()) {
BakeRecipe recipe = helmTemplateUtils.buildBakeRecipe(env, bakeManifestRequest);
}
}

public void exceptionDownloading() throws IOException {
// When artifactDownloader throws an exception, make sure we wrap it and get
// a chance to include our own message, so the exception that goes up the
Expand Down

0 comments on commit 184eeaa

Please sign in to comment.