Some null pointer exception handling