Bug 1057866 - Handle null callbacks in ChromeCast code. r=mfinkle a=sylvestre
authorWes Johnston <wjohnston@mozilla.com>
Mon, 25 Aug 2014 16:19:27 -0700
changeset 217694 46c3498c3bcd3386a9011bb554f69cd3726df266
parent 217693 d9f049319699de2e8fd50f7603520490f95e4c22
child 217695 b09553fc5f332a911acf132d9c9d23582ee5f24f
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, sylvestre
bugs1057866
milestone33.0a2
Bug 1057866 - Handle null callbacks in ChromeCast code. r=mfinkle a=sylvestre
mobile/android/base/ChromeCast.java
--- a/mobile/android/base/ChromeCast.java
+++ b/mobile/android/base/ChromeCast.java
@@ -212,25 +212,30 @@ class ChromeCast implements GeckoMediaPl
     }
 
     public void stop(final EventCallback callback) {
         // Nothing to be done here
         callback.sendSuccess(null);
     }
 
     public boolean verifySession(final EventCallback callback) {
+        String msg = null;
         if (apiClient == null || !apiClient.isConnected()) {
-            debug("Can't play. No connection");
-            callback.sendError("Not connected");
-            return false;
+            msg = "Not connected";
         }
 
         if (mSessionId == null) {
-            debug("Can't play. No session");
-            callback.sendError("No session");
+            msg = "No session";
+        }
+
+        if (msg != null) {
+            debug(msg);
+            if (callback != null) {
+                callback.sendError(msg);
+            }
             return false;
         }
 
         return true;
     }
 
     public void play(final EventCallback callback) {
         if (!verifySession(callback)) {