Be explicit about if/else statements by checking all flow logic.

Potential bugs found by Coverity scan.