make sure we only shut down the stream if we actually have an active stream
[tricorder.git] / js / tricorder.js
index 317fbca063edbe99cc21e64c3f6d16f29d772c0e..50b0625c6fefe96db91c9df7ff9effbea79d5cb4 100644 (file)
@@ -281,8 +281,10 @@ var gModSound = {
       window.requestAnimationFrame(gModSound.paintAnalyzerFrame);
   },
   deactivate: function() {
-    gModSound.mDisplay.active = false;
-    gModSound.mAudio.stream.stop();
+    if (gModSound.mDisplay.active) {
+      gModSound.mAudio.stream.stop();
+      gModSound.mDisplay.active = false;
+    }
     gSounds.scan.pause();
   },
 }