gitignore+NPE

Adding gitignore (for peace of mind) and taking care of a NullPointerException.
Thanks for a good lib!