Fixed Cppcheck warning about 'null pointer dereference or redundant condition'