forked from catchorg/Catch2
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:
@ -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 {
|
||||
|
Reference in New Issue
Block a user