aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/pdf/PDFViewer.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/pdf/PDFViewer.tsx')
-rw-r--r--src/client/views/pdf/PDFViewer.tsx6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index 440a20e8e..17f65c7a6 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -151,7 +151,7 @@ class Viewer extends React.Component<IViewerProps> {
}
}
- makeAnnotationDocument = (sourceDoc: Doc): Doc => {
+ makeAnnotationDocument = (sourceDoc: Doc | undefined): Doc => {
let annoDocs: Doc[] = [];
this._savedAnnotations.forEach((key: number, value: HTMLDivElement[]) => {
for (let anno of value) {
@@ -170,7 +170,9 @@ class Viewer extends React.Component<IViewerProps> {
let annoDoc = new Doc();
annoDoc.annotations = new List<Doc>(annoDocs);
- DocUtils.MakeLink(sourceDoc, annoDoc, undefined, `Annotation from ${StrCast(this.props.parent.Document.title)}`, "", StrCast(this.props.parent.Document.title));
+ if (sourceDoc) {
+ DocUtils.MakeLink(sourceDoc, annoDoc, undefined, `Annotation from ${StrCast(this.props.parent.Document.title)}`, "", StrCast(this.props.parent.Document.title));
+ }
this._savedAnnotations.clear();
return annoDoc;
}