File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -361,6 +361,10 @@ class HierarchicalClusteringIndex : public NNIndex<Distance>
361
361
*/
362
362
std::vector<PointInfo> points;
363
363
364
+ Node (){
365
+ pivot = NULL ;
366
+ pivot_index = SIZE_MAX;
367
+ }
364
368
/* *
365
369
* destructor
366
370
* calling Node destructor explicitly
@@ -369,6 +373,8 @@ class HierarchicalClusteringIndex : public NNIndex<Distance>
369
373
{
370
374
for (size_t i=0 ; i<childs.size (); i++){
371
375
childs[i]->~Node ();
376
+ pivot = NULL ;
377
+ pivot_index = -1 ;
372
378
}
373
379
};
374
380
@@ -380,7 +386,10 @@ class HierarchicalClusteringIndex : public NNIndex<Distance>
380
386
Index* obj = static_cast <Index*>(ar.getObject ());
381
387
ar & pivot_index;
382
388
if (Archive::is_loading::value) {
383
- pivot = obj->points_ [pivot_index];
389
+ if (pivot_index != SIZE_MAX)
390
+ pivot = obj->points_ [pivot_index];
391
+ else
392
+ pivot = NULL ;
384
393
}
385
394
size_t childs_size;
386
395
if (Archive::is_saving::value) {
You can’t perform that action at this time.
0 commit comments