Skip to content

Commit 9b72b7d

Browse files
mose-x.zmkevinlin09
authored andcommitted
fix wan2.5 i2i
1 parent 360c1ff commit 9b72b7d

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/main/java/com/alibaba/dashscope/aigc/imagesynthesis/ImageSynthesisParam.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,12 @@ public void checkAndUpload() throws NoApiKeyException, UploadFileException {
153153
inputChecks.put(SKETCH_IMAGE_URL, this.sketchImageUrl);
154154
inputChecks.put(BASE_IMAGE_URL, this.baseImageUrl);
155155
inputChecks.put(MASK_IMAGE_URL, this.maskImageUrl);
156-
int imagesSize = this.images.size();
157-
for (int i = 0; i < imagesSize; i++) {
158-
inputChecks.put(IMAGES + "[" + i + "]", this.images.get(i));
156+
int imagesSize = 0;
157+
if (this.images != null) {
158+
imagesSize = this.images.size();
159+
for (int i = 0; i < imagesSize; i++) {
160+
inputChecks.put(IMAGES + "[" + i + "]", this.images.get(i));
161+
}
159162
}
160163

161164
boolean isUpload = PreprocessInputImage.checkAndUploadImage(getModel(), inputChecks, getApiKey());
@@ -167,12 +170,10 @@ public void checkAndUpload() throws NoApiKeyException, UploadFileException {
167170
this.sketchImageUrl = inputChecks.get(SKETCH_IMAGE_URL);
168171
this.baseImageUrl = inputChecks.get(BASE_IMAGE_URL);
169172
this.maskImageUrl = inputChecks.get(MASK_IMAGE_URL);
170-
List<String> newImages = new ArrayList<>();
171-
for (int i = 0; i < imagesSize; i++) {
172-
newImages.add(inputChecks.get(IMAGES + "[" + i + "]"));
173-
}
174-
if (!newImages.isEmpty()) {
175-
this.images = newImages;
173+
if (imagesSize > 0) {
174+
for (int i = 0; i < imagesSize; i++) {
175+
this.images.add(inputChecks.get(IMAGES + "[" + i + "]"));
176+
}
176177
}
177178
}
178179
}

0 commit comments

Comments
 (0)