added checks for valid pointers after locking
Merge pull request #424 from tdev/lock-checking

Added checks for valid pointers after locking