From 4023bc6b8fdd66ee30eee8fec1c4f8fea97ff204 Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Tue, 15 Feb 2022 14:14:42 +0100 Subject: [PATCH] Making sure quote/start/end don't throw errors in Annotorious --- src/WebAnnotation.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/WebAnnotation.js b/src/WebAnnotation.js index b64cd9a..a2195e7 100644 --- a/src/WebAnnotation.js +++ b/src/WebAnnotation.js @@ -103,17 +103,17 @@ export default class WebAnnotation { /** Shorthand for the 'exact' field of the TextQuoteSelector **/ get quote() { - return this.selector('TextQuoteSelector').exact; + return this.selector('TextQuoteSelector')?.exact; } /** Shorthand for the 'start' field of the TextPositionSelector **/ get start() { - return this.selector('TextPositionSelector').start; + return this.selector('TextPositionSelector')?.start; } /** Shorthand for the 'end' field of the TextPositionSelector **/ get end() { - return this.selector('TextPositionSelector').end; + return this.selector('TextPositionSelector')?.end; } }