diff --git a/web/src/components/FOI/Home/Redlining.js b/web/src/components/FOI/Home/Redlining.js index 7b6583d2..5d916353 100644 --- a/web/src/components/FOI/Home/Redlining.js +++ b/web/src/components/FOI/Home/Redlining.js @@ -1339,7 +1339,7 @@ const Redlining = React.forwardRef( if (docInstance && documentList.length > 0) { const document = docInstance?.UI.iframeWindow.document; document.getElementById("create_response_pdf").addEventListener("click", handleCreateResponsePDFClick); - docViewer.setWatermark({ + docViewer?.setWatermark({ // Draw custom watermark in middle of the document custom: (ctx, pageNumber, pageWidth, pageHeight) => { // ctx is an instance of CanvasRenderingContext2D @@ -1347,8 +1347,8 @@ const Redlining = React.forwardRef( // Hence being able to leverage those properties let originalPage = pageMappedDocs['stitchedPageLookup'][pageNumber] let doc = pageFlags.find(d => d.documentid === originalPage.docid); - let pageFlag = doc.pageflag.find(f => f.page === originalPage.page); - if (pageFlag.flagid === pageFlagTypes["Duplicate"]) { + let pageFlag = doc?.pageflag?.find(f => f.page === originalPage.page); + if (pageFlag?.flagid === pageFlagTypes["Duplicate"]) { ctx.fillStyle = "#ff0000"; ctx.font = "20pt Arial"; ctx.globalAlpha = 0.4; @@ -1360,7 +1360,7 @@ const Redlining = React.forwardRef( ctx.restore(); } - if (pageFlag.flagid === pageFlagTypes["Not Responsive"]) { + if (pageFlag?.flagid === pageFlagTypes["Not Responsive"]) { ctx.fillStyle = "#ff0000"; ctx.font = "20pt Arial"; ctx.globalAlpha = 0.4;