Fix logic error that could cause the index to have an empty filename.
Merge remote-tracking branch 'sam/hashdb_sqlite' into hashdb_sqlite