Avoid possible segfault via conditional