Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include/internal/catch_assertionresult.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2019-09-08 12:17:44 +0200
committerMartin Hořeňovský2019-09-08 14:35:01 +0200
commit14362533bb50596049f1b46bcc6d333208576a87 (patch)
treec5bec46bd94909144da7d4423fb0f2571dd6e04c /include/internal/catch_assertionresult.cpp
parenta5bb3e3d911e5c43feb359f47848b7630d623338 (diff)
downloadcatch3-14362533bb50596049f1b46bcc6d333208576a87.tar.gz
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.
Diffstat (limited to 'include/internal/catch_assertionresult.cpp')
-rw-r--r--include/internal/catch_assertionresult.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/internal/catch_assertionresult.cpp b/include/internal/catch_assertionresult.cpp
index 4ce07187..8f505d04 100644
--- a/include/internal/catch_assertionresult.cpp
+++ b/include/internal/catch_assertionresult.cpp
@@ -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 {