Skip to content


fix for NPE in TDBatcher #66

wants to merge 1 commit into from

2 participants


I'm not sure how I did it, but I ran into a case where I was getting the following NullPointerException:

     [exec] [DEBUG] E/AndroidRuntime(  340): java.lang.NullPointerException
     [exec] [DEBUG] E/AndroidRuntime(  340):    at
     [exec] [DEBUG] E/AndroidRuntime(  340):    at com.couchbase.touchdb.replicator.TDPuller.changeTrackerStopped(
     [exec] [DEBUG] E/AndroidRuntime(  340):    at com.couchbase.touchdb.replicator.changetracker.TDChangeTracker.stopped(
     [exec] [DEBUG] E/AndroidRuntime(  340):    at com.couchbase.touchdb.replicator.changetracker.TDChangeTracker.stop(
     [exec] [DEBUG] E/AndroidRuntime(  340):    at
     [exec] [DEBUG] E/AndroidRuntime(  340):    at

Since other parts of TDBatcher were checking to see if the handler object was null, I just added a null check in flush() and it seems to work ok.

couchbaselabs member

Thanks, I ran into this same one yesterday. I have the patch in my tree already. Unfortunately the replicator is in a sad place right now. Hopefully I make more tangible progress today.

@pegli pegli closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 9, 2012
  1. @pegli
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 1 deletion.
  1. +3 −1 TouchDB-Android/src/com/couchbase/touchdb/support/
4 TouchDB-Android/src/com/couchbase/touchdb/support/
@@ -72,7 +72,9 @@ public void queueObject(T object) {
public void flush() {
synchronized(this) {
if(inbox != null) {
- handler.removeCallbacks(processNowRunnable);
+ if (handler != null) {
+ handler.removeCallbacks(processNowRunnable);
+ }
Something went wrong with that request. Please try again.