Prevented null pointer exception