diff --git a/backend/src/main/java/codesquard/app/api/item/ItemController.java b/backend/src/main/java/codesquard/app/api/item/ItemController.java index 7f3b305c4..838f32bee 100644 --- a/backend/src/main/java/codesquard/app/api/item/ItemController.java +++ b/backend/src/main/java/codesquard/app/api/item/ItemController.java @@ -1,5 +1,6 @@ package codesquard.app.api.item; +import java.util.ArrayList; import java.util.List; import javax.validation.Valid; @@ -71,6 +72,9 @@ public ApiResponse modifyItem(@PathVariable Long itemId, @Valid @RequestPart("item") ItemModifyRequest request, @RequestPart(value = "thumbnailImage", required = false) MultipartFile thumbnailImage, @AuthPrincipal Principal principal) { + if (addImages == null) { + addImages = new ArrayList<>(); + } itemService.modifyItem(itemId, request, addImages, thumbnailImage, principal); return ApiResponse.ok("상품 수정을 완료하였습니다.", null); } diff --git a/backend/src/main/java/codesquard/app/api/item/ItemService.java b/backend/src/main/java/codesquard/app/api/item/ItemService.java index 0bfaee2f5..3a53dcf8d 100644 --- a/backend/src/main/java/codesquard/app/api/item/ItemService.java +++ b/backend/src/main/java/codesquard/app/api/item/ItemService.java @@ -1,5 +1,6 @@ package codesquard.app.api.item; +import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -106,6 +107,9 @@ public void modifyItem(Long itemId, ItemModifyRequest request, List deleteImageUrls = request.getDeleteImageUrls(); + if (deleteImageUrls == null) { + deleteImageUrls = new ArrayList<>(); + } int deleteImageSize = deleteImages(itemId, deleteImageUrls); log.debug("이미지 테이블의 삭제 결과 : 삭제 개수={}", deleteImageSize);