Switch to using `empty()` to check for emptiness.
Do not reassign variable before using it.

Swap the #ifdef to fix this.
Merge pull request #412 from XhmikosR/master

Fix a few Cppcheck issues