Handled Null pointer exception.