From 74d44eb8940317a0392232c0b3e550627d79f893 Mon Sep 17 00:00:00 2001
From: James Brill <contact@jamesbrill.co.uk>
Date: Fri, 21 Aug 2020 20:46:41 +0100
Subject: [PATCH] Only execute disconnect logic if already listening

---
 src/RecognitionManager.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/RecognitionManager.js b/src/RecognitionManager.js
index 1d21b17..76bdc46 100644
--- a/src/RecognitionManager.js
+++ b/src/RecognitionManager.js
@@ -69,7 +69,7 @@ export default class RecognitionManager {
   }
 
   disconnect(disconnectType) {
-    if (this.browserSupportsSpeechRecognition) {
+    if (this.browserSupportsSpeechRecognition && this.listening) {
       switch (disconnectType) {
         case 'ABORT':
           this.pauseAfterDisconnect = true