Avoiding null pointer exception which was returned.