From 5477ac7bb298fe55f7397541d5b390b226bdb417 Mon Sep 17 00:00:00 2001
From: hiroshisuga <45039819+hiroshisuga@users.noreply.github.com>
Date: Mon, 26 Jul 2021 23:12:10 +0900
Subject: [PATCH] this.recognition can be null

---
 .../ui/components/captions/pad/component.jsx     | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/bigbluebutton-html5/imports/ui/components/captions/pad/component.jsx b/bigbluebutton-html5/imports/ui/components/captions/pad/component.jsx
index 48576e7efd..40ea5e80a9 100644
--- a/bigbluebutton-html5/imports/ui/components/captions/pad/component.jsx
+++ b/bigbluebutton-html5/imports/ui/components/captions/pad/component.jsx
@@ -87,13 +87,15 @@ class Pad extends PureComponent {
     this.toggleListen = this.toggleListen.bind(this);
     this.handleListen = this.handleListen.bind(this);
     
-    this.recognition.addEventListener('end', () => {
-      const { listening } = this.state;
-      if (listening) {
-        notify(intl.formatMessage(intlMessages.speechRecognitionStop), 'info', 'warning');
-        this.stopListen();
-      }
-    });
+    if (this.recognition) {
+      this.recognition.addEventListener('end', () => {
+        const { listening } = this.state;
+        if (listening) {
+          notify(intl.formatMessage(intlMessages.speechRecognitionStop), 'info', 'warning');
+          this.stopListen();
+        }
+      });
+    }
   }
 
   componentDidUpdate() {
-- 
GitLab