feat: avoid dereferencing nullptr (#28862)

issue: #28793

Signed-off-by: sunby <sunbingyi1992@gmail.com>
pull/28812/head^2
Bingyi Sun 2023-12-01 10:20:32 +08:00 committed by GitHub
parent 043ac87be0
commit 8036ee13fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -128,9 +128,8 @@ VectorDiskAnnIndex<T>::Build(const Config& config) {
build_config[DISK_ANN_THREADS_NUM] =
std::atoi(num_threads.value().c_str());
}
knowhere::DataSet* ds_ptr = nullptr;
build_config.erase("insert_files");
auto stat = index_.Build(*ds_ptr, build_config);
auto stat = index_.Build({}, build_config);
if (stat != knowhere::Status::success)
PanicInfo(ErrorCode::IndexBuildError,
"failed to build disk index, " + KnowhereStatusString(stat));
@ -184,8 +183,7 @@ VectorDiskAnnIndex<T>::BuildWithDataset(const DatasetPtr& dataset,
auto raw_data = const_cast<void*>(milvus::GetDatasetTensor(dataset));
local_chunk_manager->Write(local_data_path, offset, raw_data, data_size);
knowhere::DataSet* ds_ptr = nullptr;
auto stat = index_.Build(*ds_ptr, build_config);
auto stat = index_.Build({}, build_config);
if (stat != knowhere::Status::success)
PanicInfo(ErrorCode::IndexBuildError,
"failed to build index, " + KnowhereStatusString(stat));