- Moved NULL check before dereferencing ptr
Merge pull request #5 from felipensp/coverity_fix

- Moved NULL check before dereferencing ptr