Protect against NPE
Merge pull request #26 from gamerson/master

Protect against NPE