From 35d7259bade436ed2e69e3e4a823b2b1a73057db Mon Sep 17 00:00:00 2001 From: 101 Date: Sat, 16 Mar 2024 19:00:55 +0900 Subject: [PATCH] update EditContentTableTitle.java --- .../domain/content/service/EditContentTableTitle.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/example/daemawiki/domain/content/service/EditContentTableTitle.java b/src/main/java/com/example/daemawiki/domain/content/service/EditContentTableTitle.java index 6872753b..ad0f2ee9 100644 --- a/src/main/java/com/example/daemawiki/domain/content/service/EditContentTableTitle.java +++ b/src/main/java/com/example/daemawiki/domain/content/service/EditContentTableTitle.java @@ -11,6 +11,7 @@ import com.example.daemawiki.domain.revision.model.type.RevisionType; import com.example.daemawiki.domain.user.model.User; import com.example.daemawiki.domain.user.service.facade.UserFacade; +import com.example.daemawiki.global.exception.h404.ContentNotFoundException; import org.springframework.stereotype.Service; import reactor.core.publisher.Mono; import reactor.core.scheduler.Scheduler; @@ -56,7 +57,11 @@ private Mono checkPermissionAndUpdateDocument(Tuple2 c.getIndex().equals(request.index())) .toList(); - contents.getFirst().setTitle(request.newTitle()); + if (contents.getFirst() != null){ + contents.getFirst().setTitle(request.newTitle()); + } else { + return Mono.error(ContentNotFoundException.EXCEPTION); + } document.increaseVersion(); updateDocumentEditorAndUpdatedDate.execute(document, user);