Fix: Null'ed pointer usage, possible access violation.

This fixes issue #700
Merge pull request #833 from just-bank/fix-derefptr

Fix: Null'ed pointer usage, possible access violation.