Permalink
Browse files

added null checks around all uses of delegate

Change-Id: I8bdb13df2f60003490124f5e9fc0ceb4faa380cd
Reviewed-on: http://review.couchbase.org/9496
Reviewed-by: Marty Schoch <marty.schoch@gmail.com>
Reviewed-by: Chris Anderson <jchris@couchbase.com>
Tested-by: Dale Harvey <daleharvey@arandomurl.com>
Reviewed-by: Dale Harvey <daleharvey@arandomurl.com>
  • Loading branch information...
mschoch authored and Dale Harvey committed Sep 9, 2011
1 parent e61aa08 commit 2988c598d333be23c6706fec31938fc8c3f194aa
Showing with 12 additions and 4 deletions.
  1. +12 −4 src/com/couchbase/android/CouchbaseService.java
@@ -117,18 +117,24 @@ public void handleMessage(Message msg) {
}
}
else if(msg.obj instanceof String){
- couchbaseDelegate.exit((String)msg.obj);
+ if (couchbaseDelegate != null) {
+ couchbaseDelegate.exit((String)msg.obj);
+ }
}
break;
case PROGRESS:
- couchbaseDelegate.installing(msg.arg1, msg.arg2);
+ if (couchbaseDelegate != null) {
+ couchbaseDelegate.installing(msg.arg1, msg.arg2);
+ }
break;
case COMPLETE:
startCouchbaseService();
break;
case COUCHBASE_STARTED:
URL url = (URL) msg.obj;
- couchbaseDelegate.couchbaseStarted(url.getHost(), url.getPort());
+ if (couchbaseDelegate != null) {
+ couchbaseDelegate.couchbaseStarted(url.getHost(), url.getPort());
+ }
break;
}
}
@@ -185,7 +191,9 @@ public void stopCouchbase() {
* Nofity the delegate that Couchbase has started
*/
void couchbaseStarted() {
- couchbaseDelegate.couchbaseStarted(url.getHost(), url.getPort());
+ if (couchbaseDelegate != null) {
+ couchbaseDelegate.couchbaseStarted(url.getHost(), url.getPort());
+ }
}
/**

0 comments on commit 2988c59

Please sign in to comment.