summaryrefslogtreecommitdiffstats
path: root/libcxx/include/algorithm
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include/algorithm')
-rw-r--r--libcxx/include/algorithm2
1 files changed, 2 insertions, 0 deletions
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 4679845e132..f9c6843a60a 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -4751,6 +4751,8 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando
while (true)
{
__restart:
+ if (__nth == __last)
+ return;
difference_type __len = __last - __first;
switch (__len)
{
OpenPOWER on IntegriCloud