Fixes #1208 (closed)
This should make it easier for cppcheck (although this was a false positive) but it also makes the code more readable and shorter.