[gnome-sound-recorder] record: avoid calls to undefined vars in case of invalid audio settings:



commit 64e82c29cd723c15732f497882f5a5425fc3433b
Author: Felipe Borges <felipeborges src gnome org>
Date:   Sat Apr 12 23:06:47 2014 -0300

    record: avoid calls to undefined vars in case of invalid audio settings:
    
    Signed-off-by: Meg Ford <meg localhost localdomain>

 src/record.js |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/record.js b/src/record.js
index f01b346..8aa4891 100644
--- a/src/record.js
+++ b/src/record.js
@@ -66,6 +66,7 @@ const Record = new Lang.Class({
         if(this.srcElement == null) {
           this._showErrorDialog(_('Your audio capture settings are invalid.'));
           this.onEndOfStream();
+          return;
         }
         
         this.pipeline.add(this.srcElement);
@@ -181,7 +182,9 @@ const Record = new Lang.Class({
     onEndOfStream: function() { 
         this.pipeline.set_state(Gst.State.NULL);
         this.pipeState = PipelineStates.STOPPED;
-        this.recordBus.remove_signal_watch();
+        if (this.recordBus) {
+               this.recordBus.remove_signal_watch();
+        }
         this._updateTime(); 
     },
         
@@ -251,7 +254,9 @@ const Record = new Lang.Class({
     },
     
     setVolume: function(value) {
-        this.volume.set_volume(GstAudio.StreamVolumeFormat.CUBIC, value);
+        if (this.volume) {
+            this.volume.set_volume(GstAudio.StreamVolumeFormat.CUBIC, value);
+        }
     },
     
     _showErrorDialog: function(errorStrOne, errorStrTwo) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]