Since this is used as an event handler, the event object will end up acting as a truthy value here.

If that is intentional, it should be commented really explicitly.  I've been bitten by nasty bugs that way, though.

In any case, I recommend that you just remove the deferred callback case if you can, and that will make the entire problem go away.