Do not blindly access empty StringRefs

This commit is contained in:
Martin Hořeňovský 2019-09-08 17:44:56 +02:00
parent 7b865daccc
commit e2b3443fe7
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A

View File

@ -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<std::string>(m_info.capturedExpression);
else {
expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 );