From e2b3443fe7211f265c95f878d06d8fd4abf38f27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sun, 8 Sep 2019 17:44:56 +0200 Subject: [PATCH] Do not blindly access empty StringRefs --- include/internal/catch_assertionresult.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/internal/catch_assertionresult.cpp b/include/internal/catch_assertionresult.cpp index 5da1cfdf..a116bffa 100644 --- a/include/internal/catch_assertionresult.cpp +++ b/include/internal/catch_assertionresult.cpp @@ -61,7 +61,7 @@ namespace Catch { std::string AssertionResult::getExpressionInMacro() const { std::string expr; - if( m_info.macroName[0] == 0 ) + if( m_info.macroName.empty() ) expr = static_cast(m_info.capturedExpression); else { expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 );