Fix potential NPE when passing 'null' as params
This commit is contained in:
parent
67b0a26474
commit
5ec099756f
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -117,9 +117,11 @@ public class DockerApi {
|
||||
private URI buildUrl(String path, Object... params) {
|
||||
try {
|
||||
URIBuilder builder = new URIBuilder("/" + API_VERSION + path);
|
||||
int param = 0;
|
||||
while (param < params.length) {
|
||||
builder.addParameter(Objects.toString(params[param++]), Objects.toString(params[param++]));
|
||||
if (params != null) {
|
||||
int param = 0;
|
||||
while (param < params.length) {
|
||||
builder.addParameter(Objects.toString(params[param++]), Objects.toString(params[param++]));
|
||||
}
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user