Skip to content

Commit 466f3f8

Browse files
authored
Fix entry point handling for Infinity/NaN data values to prevent SVS Crash (#174)
Ensure the entry point ID is correctly handled when it contains Infinity or NaN values. This change prevents SVS from crashing in such cases by adding proper checks and handling logic.
1 parent 25b80d5 commit 466f3f8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

include/svs/core/medioid.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,11 @@ size_t find_medioid(
340340
global_min = neighbor;
341341
}
342342
});
343+
344+
if (global_min.id() >= data.size()) {
345+
global_min = Neighbor<size_t>(0, global_min.distance());
346+
}
347+
343348
return global_min.id();
344349
}
345350

0 commit comments

Comments
 (0)