If there be found a balance due from the plaintiff in the action to the defendant, judgment shall be rendered in favor of the defendant for the amount thereof, but no such judgment shall be rendered against the plaintiff when the contract, which is the subject of the action, shall have been assigned before the commencement of such action, nor for any balance due from any other person than the plaintiff in the action.