fix ivflib (#1410)

Summary:
if `ils = dynamic_cast<ArrayInvertedLists *> (index_ivf->invlists)` failed, `ils` would be `nullptr`.
so check if `ils` is `nullptr` before use it.

Pull Request resolved: https://github.com/facebookresearch/faiss/pull/1410

Reviewed By: beauby

Differential Revision: D23985814

Pulled By: mdouze

fbshipit-source-id: f62a3988e74b4de1f1c9a127475368302a35d4a5
pull/1431/head
adream307 2020-09-29 03:38:35 -07:00 committed by Facebook GitHub Bot
parent 27393c436c
commit c69c18ef32
1 changed files with 1 additions and 1 deletions

View File

@ -180,9 +180,9 @@ SlidingIndexWindow::SlidingIndexWindow (Index *index): index (index) {
n_slice = 0;
IndexIVF* index_ivf = const_cast<IndexIVF*>(extract_index_ivf (index));
ils = dynamic_cast<ArrayInvertedLists *> (index_ivf->invlists);
nlist = ils->nlist;
FAISS_THROW_IF_NOT_MSG (ils,
"only supports indexes with ArrayInvertedLists");
nlist = ils->nlist;
sizes.resize(nlist);
}