I'm experimenting with contract CrowdFunder which I found on the net


and I'm getting an error Solidity exception (bad jump) when function payOut() is executed and state enum variable is different than the one which is passed to inState(State.Successful)

enum State {

   modifier inState(State _state) {
        if (state != _state) throw;

If state == _state then there is no error. Function executes as expected.

function payOut()
        if(!fundRecipient.send(this.balance)) {


Is this because inState function is defined to execute throw when the _state !=state. Is this the cause of Solidity exception (bad jump)?

2 Answers 2


The modifier inState(State _state) is basically an assertion insuring that before the actual function runs (represented by the _ in the modifier's code), the current state of the contract is in the state given. It sounds to me like it's operating exactly as it should. It's another way of saying "this function (payOut) should only run if the contracts state is _state.

The _ in the modifiers code represents the code in the function that is being modified. So, if the _ comes after the modifiers test, payOut will only run if the condition is met. If the _ came before the modifiers test, payOut would have run first, and then the modifiers test would run.

In the very old days of raw C programming, this may have been done with a #define macro.


"bad jump" is just the way "throw" is modeled, so it is expected behaviour.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.