Check for empty expression properly

The old code was a left-over from the times when the
`capturedExpression` member was a `const char*`, which could always
be indexed. With the change to use `StringRef`, blindly indexing 0th
element is invalid, as it is not indexable part of a StringRef.
This commit is contained in:
Martin Hořeňovský 2019-09-08 12:17:44 +02:00
parent a5bb3e3d91
commit 14362533bb
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
1 changed files with 1 additions and 1 deletions

View File

@ -45,7 +45,7 @@ namespace Catch {
}
bool AssertionResult::hasExpression() const {
return m_info.capturedExpression[0] != 0;
return !m_info.capturedExpression.empty();
}
bool AssertionResult::hasMessage() const {