From 0792781dc577afe8c3ca41d3bdfa21e9a3bba2da Mon Sep 17 00:00:00 2001 From: Sterling Harper Date: Fri, 5 Oct 2018 22:49:29 -0400 Subject: [PATCH] Fix indexing below lower bound due to bin. search --- include/openmc/search.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/openmc/search.h b/include/openmc/search.h index 81370a3de..c91ad18fe 100644 --- a/include/openmc/search.h +++ b/include/openmc/search.h @@ -14,6 +14,7 @@ template typename std::iterator_traits::difference_type lower_bound_index(It first, It last, const T& value) { + if (*first == value) return 0; It index = std::lower_bound(first, last, value) - 1; return (index == last) ? -1 : index - first; }