Fix cppcheck's 'Possible null pointer dereference'