From ec371c2dd1e5d8e83d00f4f4c7f38183dec4e646 Mon Sep 17 00:00:00 2001 From: WorabordinC Date: Sun, 31 Mar 2024 12:38:00 +0700 Subject: [PATCH] clean code smell --- .../main/java/com/kampus/kbazaar/cartitem/CartItemService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kbazaar/src/main/java/com/kampus/kbazaar/cartitem/CartItemService.java b/kbazaar/src/main/java/com/kampus/kbazaar/cartitem/CartItemService.java index ae1518b..fe05ea3 100644 --- a/kbazaar/src/main/java/com/kampus/kbazaar/cartitem/CartItemService.java +++ b/kbazaar/src/main/java/com/kampus/kbazaar/cartitem/CartItemService.java @@ -25,7 +25,8 @@ public CartItemService(CartItemRepository cartItemRepository, CartRepository car public CartResponse getCartByUsername(String username) { Optional optionalCartResponse = cartRepository.getCartByUsername(username); - CartResponse cartResponse = new CartResponse(); + new CartResponse(); + CartResponse cartResponse; if (optionalCartResponse.isPresent()) { // get cart cartResponse = optionalCartResponse.get().toResponse();