Resolve CID 1037079

Cppcheck cannot detect this because it's a problem of combines usage of two functions.

The second check which is eliminated here becomes redundant once the first check is introduced.