add gitignore
handle null pointer exception