forked from OSchip/llvm-project
[Frontend] Don't index into an empty string.
Found by msan! llvm-svn: 303686
This commit is contained in:
parent
f43ece3ff5
commit
4e382f9ee9
|
@ -1252,7 +1252,7 @@ void TextDiagnostic::emitSnippetAndCaret(
|
|||
}
|
||||
|
||||
// Finally, remove any blank spaces from the end of CaretLine.
|
||||
while (CaretLine[CaretLine.size() - 1] == ' ')
|
||||
while (!CaretLine.empty() && CaretLine[CaretLine.size() - 1] == ' ')
|
||||
CaretLine.erase(CaretLine.end() - 1);
|
||||
|
||||
// Emit what we have computed.
|
||||
|
|
Loading…
Reference in New Issue