Skip to content

Commit 5ec0997

Browse files
committed
Fix potential NPE when passing 'null' as params
1 parent 67b0a26 commit 5ec0997

File tree

1 file changed

+6
-4
lines changed
  • spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker

1 file changed

+6
-4
lines changed

Diff for: spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -117,9 +117,11 @@ private URI buildUrl(String path, Collection<?> params) {
117117
private URI buildUrl(String path, Object... params) {
118118
try {
119119
URIBuilder builder = new URIBuilder("/" + API_VERSION + path);
120-
int param = 0;
121-
while (param < params.length) {
122-
builder.addParameter(Objects.toString(params[param++]), Objects.toString(params[param++]));
120+
if (params != null) {
121+
int param = 0;
122+
while (param < params.length) {
123+
builder.addParameter(Objects.toString(params[param++]), Objects.toString(params[param++]));
124+
}
123125
}
124126
return builder.build();
125127
}

0 commit comments

Comments
 (0)