Skip to content
This repository has been archived by the owner on Apr 30, 2019. It is now read-only.

Commit

Permalink
Merge pull request #15 from android/loganj/bail_fast
Browse files Browse the repository at this point in the history
abort post early if bus is destroyed
  • Loading branch information
pyricau committed Sep 19, 2013
2 parents 19dad55 + 55f1acb commit 7d4c9a1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions library/src/main/java/com/squareup/otto/OttoBus.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,14 @@ private static void throwRuntimeException(String msg, InvocationTargetException

@Override public void post(Object event) {
mainThread.enforce();

boolean dispatched = root.doPost(event);
if (dispatched) {
dispatchQueuedEvents();
} else {
deadEventHandler.onDeadEvent(event);
if (!destroyed) {
boolean dispatched = root.doPost(event);
if (dispatched) {
dispatchQueuedEvents();
return;
}
}
deadEventHandler.onDeadEvent(event);
}

/**
Expand Down

0 comments on commit 7d4c9a1

Please sign in to comment.