Run cheaper check first, don't check the same condition twice.
Merge pull request #381 from Dmitry-Me/checkBooleanFlagFirst

Run cheaper check first, don't check the same condition twice.