I believe this fixes #7628. Seemed to just be a bit of logic mixup.

I also think I got the style right, but my attempts at using `astyle` with the command in the code docs didn't work. (I'm no `vi` power user, but I'm not a n00b. Will file the doc bug separately.)