Fix a condition that could cause an exception.