I get an exception when I call getBalance in Remix and the contract balance is greater than 0 (ie. I sent some ether using the fallback function):
Exception during execution. (invalid opcode). Please debug the transaction for more information.
When contract balance is 0 then getBalance correctly returns 0.
pragma solidity ^0.4.0;
contract Test {
function() payable {}
function getBalance() public constant returns(uint bal) {
bal = this.balance;
return bal;
}
}