mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-30 01:03:30 +01:00
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:
parent
a5bb3e3d91
commit
14362533bb
@ -45,7 +45,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool AssertionResult::hasExpression() const {
|
bool AssertionResult::hasExpression() const {
|
||||||
return m_info.capturedExpression[0] != 0;
|
return !m_info.capturedExpression.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AssertionResult::hasMessage() const {
|
bool AssertionResult::hasMessage() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user