From 6e71c311ed04300698365a367c1e13d9246d52d7 Mon Sep 17 00:00:00 2001 From: Sam Wilkins Date: Mon, 18 May 2020 17:28:47 -0700 Subject: added null check --- src/client/views/nodes/VideoBox.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx index 6ec48ca89..f75a4c529 100644 --- a/src/client/views/nodes/VideoBox.tsx +++ b/src/client/views/nodes/VideoBox.tsx @@ -124,7 +124,7 @@ export class VideoBox extends ViewBoxAnnotatableComponent { this.props.removeDocument?.(b); - this.createRealSummaryLink(response.accessPaths.agnostic.client); + this.createRealSummaryLink(response?.accessPaths?.agnostic?.client); }); } else { //convert to desired file format @@ -135,7 +135,10 @@ export class VideoBox extends ViewBoxAnnotatableComponent { + private createRealSummaryLink = (relative: string | undefined) => { + if (!relative) { + return; + } const url = this.choosePath(Utils.prepend(relative)); const width = (this.layoutDoc._width || 0); const height = (this.layoutDoc._height || 0); -- cgit v1.2.3-70-g09d2 From d2d01e3c827e53977bac8f9ceeef69eda31cfa4f Mon Sep 17 00:00:00 2001 From: Sam Wilkins Date: Mon, 18 May 2020 17:31:39 -0700 Subject: cleanup --- src/client/views/nodes/VideoBox.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx index f75a4c529..a3abaedfa 100644 --- a/src/client/views/nodes/VideoBox.tsx +++ b/src/client/views/nodes/VideoBox.tsx @@ -123,22 +123,26 @@ export class VideoBox extends ViewBoxAnnotatableComponent { - this.props.removeDocument?.(b); - this.createRealSummaryLink(response?.accessPaths?.agnostic?.client); + const resolved = response?.accessPaths?.agnostic?.client; + if (resolved) { + this.props.removeDocument?.(b); + this.createRealSummaryLink(resolved); + } }); } else { //convert to desired file format const dataUrl = canvas.toDataURL('image/png'); // can also use 'image/png' // if you want to preview the captured image, const filename = path.basename(encodeURIComponent("snapshot" + StrCast(this.rootDoc.title).replace(/\..*$/, "") + "_" + (this.layoutDoc.currentTimecode || 0).toString().replace(/\./, "_"))); - VideoBox.convertDataUri(dataUrl, filename).then(this.createRealSummaryLink); + VideoBox.convertDataUri(dataUrl, filename).then((returnedFilename: string) => { + if (returnedFilename) { + this.createRealSummaryLink(returnedFilename); + } + }); } } - private createRealSummaryLink = (relative: string | undefined) => { - if (!relative) { - return; - } + private createRealSummaryLink = (relative: string) => { const url = this.choosePath(Utils.prepend(relative)); const width = (this.layoutDoc._width || 0); const height = (this.layoutDoc._height || 0); -- cgit v1.2.3-70-g09d2