Fix FileCheck crash when fuzzy scanning starting at the end of the file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90065 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2009-11-29 08:30:24 +00:00
parent cd188e9665
commit a76a7883b5

View File

@ -398,7 +398,7 @@ void Pattern::PrintFailureInfo(const SourceMgr &SM, StringRef Buffer,
} }
} }
if (BestQuality < 50) { if (Best != StringRef::npos && BestQuality < 50) {
// Print the "possible intended match here" line if we found something // Print the "possible intended match here" line if we found something
// reasonable. // reasonable.
SM.PrintMessage(SMLoc::getFromPointer(Buffer.data() + Best), SM.PrintMessage(SMLoc::getFromPointer(Buffer.data() + Best),