@@ -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