Fixes crashes when using bad smiles in the cached smiles holders (#3798)

* Fixes #3797

* Update Code/GraphMol/SubstructLibrary/SubstructLibrary.cpp

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>

* Update test to include positive and negative results

Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
This commit is contained in:
Brian Kelley
2021-02-15 04:49:19 -05:00
committed by GitHub
parent 213f537edd
commit bd00fda39e
4 changed files with 47 additions and 4 deletions

View File

@@ -25,7 +25,14 @@ void fillPatterns(const SubstructLibrary &slib,
for (unsigned int idx = start;
idx < end;
idx += numThreads) {
fps[idx] = fph.makeFingerprint( *slib.getMol(idx).get() );
auto mol = slib.getMol(idx);
if (mol.get()) {
fps[idx] = fph.makeFingerprint( *mol.get() );
}
else {
// Make an empty FP
fps[idx] = fph.makeFingerprint(ROMol());
}
}
}
}