diff --git a/src/app/api/notary/OfficeFolderAnchorsController.ts b/src/app/api/notary/OfficeFolderAnchorsController.ts index 1fa7e864..ff4bc9fe 100644 --- a/src/app/api/notary/OfficeFolderAnchorsController.ts +++ b/src/app/api/notary/OfficeFolderAnchorsController.ts @@ -170,16 +170,18 @@ export default class OfficeFoldersController extends ApiController { return; } - const officeFolderAnchorFound = OfficeFolderAnchor.hydrate(officeFolderFound.folder_anchor, { - strategy: "excludeAll", - }); - - if (officeFolderAnchorFound) { - this.httpBadRequest(response, { - error: "Office folder already anchored", - folder_anchor: officeFolderAnchorFound, + if (officeFolderFound.folder_anchor) { + const officeFolderAnchorFound = OfficeFolderAnchor.hydrate(officeFolderFound.folder_anchor, { + strategy: "excludeAll", }); - return; + + if (officeFolderAnchorFound) { + this.httpBadRequest(response, { + error: "Office folder already anchored", + folder_anchor: officeFolderAnchorFound, + }); + return; + } } const officeFolder = OfficeFolder.hydrate(officeFolderFound, { strategy: "excludeAll" });