Added a couple more checks for NULL.
Merge branch 'tags_and_hashes', remote-tracking branch 'sam/hashdb_sqlite' into tags_and_hashes