diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/UserController.java b/prototype/src/main/java/org/hso/ecommerce/controller/UserController.java index 8a90d43..97c5bf6 100644 --- a/prototype/src/main/java/org/hso/ecommerce/controller/UserController.java +++ b/prototype/src/main/java/org/hso/ecommerce/controller/UserController.java @@ -1,6 +1,7 @@ package org.hso.ecommerce.controller; import org.hso.ecommerce.action.user.UpdateUserSettingsAction; +import org.hso.ecommerce.entities.shop.Address; import org.hso.ecommerce.entities.shop.CustomerOrder; import org.hso.ecommerce.entities.user.User; import org.hso.ecommerce.repos.shop.CustomerOrderRepository; @@ -38,6 +39,9 @@ public class UserController { ) { long userId = (long) session.getAttribute("userId"); User user = userRepository.findById(userId).get(); + if(user.defaultDeliveryAddress == null){ + user.defaultDeliveryAddress = new Address(); + } model.addAttribute("user", user); return "user/settings";