In the code as was, the histogram bins corresponding to the vertex were only zereod to prevent the vertex being found again if multiple vertices were requested.
So if requiring only 1 vertex, if the significance of the found vertex was not high enough it would not have been added, so the check on the number of found vertex candidates would not change, and we would be doomed to find this vertex for ever.
With a lower significance the vertex would have been added, and with more required vertices, the histogram bins would have been zeroed.
As such, have added checks such that the bins are always zeroed, and also, that if the vertex is not significant, then it bombs out of the loop, since no subsequent vertex could have a higher significance. Either of these changes should by themselves, be enough to prevent this same hang happening in the future.
This addresses ATR-19265.