aboutsummaryrefslogtreecommitdiff
path: root/binary_search_tool/binary_search_state.py
diff options
context:
space:
mode:
Diffstat (limited to 'binary_search_tool/binary_search_state.py')
-rwxr-xr-xbinary_search_tool/binary_search_state.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/binary_search_tool/binary_search_state.py b/binary_search_tool/binary_search_state.py
index 62acd759..ef276fab 100755
--- a/binary_search_tool/binary_search_state.py
+++ b/binary_search_tool/binary_search_state.py
@@ -222,6 +222,12 @@ class BinarySearchState(object):
# Prune is set.
prune_index = self.binary_search.current
+ # If found item is last item, no new items can be found
+ if prune_index == len(self.all_items) - 1:
+ self.l.LogOutput('First bad item is the last item. Breaking.')
+ self.l.LogOutput('Bad items are: %s' % self.all_items[-1])
+ break
+
# If already seen item we have no new bad items to find, finish up
if self.all_items[prune_index] in self.found_items:
self.l.LogOutput(('Found item already found before: %s. '