Avoid null pointer exception