check that console exists, and console.error exists before calling it

Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/687928f9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/687928f9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/687928f9

Branch: refs/heads/master
Commit: 687928f9cfc751789d5a445449280bba8561e260
Parents: 1ee3b9a
Author: Jesse MacFadyen <purplecabb...@gmail.com>
Authored: Fri Sep 7 15:13:44 2012 -0700
Committer: Jesse MacFadyen <purplecabb...@gmail.com>
Committed: Fri Sep 7 15:13:44 2012 -0700

----------------------------------------------------------------------
 lib/common/plugin/Media.js |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/687928f9/lib/common/plugin/Media.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/Media.js b/lib/common/plugin/Media.js
index 281ca94..cbbe70b 100644
--- a/lib/common/plugin/Media.js
+++ b/lib/common/plugin/Media.js
@@ -178,12 +178,12 @@ Media.onStatus = function(id, msgType, value) {
                 media._position = Number(value);
                 break;
             default :
-                console.error("Unhandled Media.onStatus :: " + msgType); 
+                console && console.error && console.error("Unhandled 
Media.onStatus :: " + msgType); 
                 break;
         }
     }
     else {
-        console.error("Received Media.onStatus callback for unknown media :: " 
+ id);
+         console && console.error && console.error("Received Media.onStatus 
callback for unknown media :: " + id);
     }
 
 };

Reply via email to