Skip to content

Commit 9343446

Browse files
committed
Eliminate undefined behavior where we call next on a past-the-end iterator.
Speculative fix for rdar://90735823.
1 parent 1e2b94e commit 9343446

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/SILGen/SILGenBridging.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1818,7 +1818,8 @@ void SILGenFunction::emitNativeToForeignThunk(SILDeclRef thunk) {
18181818

18191819
auto directResults = substConv.getDirectSILResults();
18201820
auto hasMultipleDirectResults
1821-
= std::next(directResults.begin()) != directResults.end();
1821+
= !directResults.empty() &&
1822+
std::next(directResults.begin()) != directResults.end();
18221823

18231824
for (unsigned paramI : indices(completionTy->getParameters())) {
18241825
if (errorParamIndex && paramI == *errorParamIndex) {

0 commit comments

Comments
 (0)