diff --git a/src/main/java/hhn/labsw/bugageocaching/util/CacheConstructionUtil.java b/src/main/java/hhn/labsw/bugageocaching/util/CacheConstructionUtil.java index 959c2f5..7dc78ac 100644 --- a/src/main/java/hhn/labsw/bugageocaching/util/CacheConstructionUtil.java +++ b/src/main/java/hhn/labsw/bugageocaching/util/CacheConstructionUtil.java @@ -171,8 +171,10 @@ public class CacheConstructionUtil { for (Cache cache1 : cacheRepository.findAll()) { if (cache1.getName().equals(cache.getName())) { - deleteNewCreatedStationsUtil(newCreatedStationList); - return ResponseEntity.status(400).body("name is already taken"); + if (cache1 != oldCache) { + deleteNewCreatedStationsUtil(newCreatedStationList); + return ResponseEntity.status(400).body("name is already taken"); + } } }