Fix bug in TokenStream parser

When presented with just '-' it would access the string at position [1]
This commit is contained in:
Mark Jansen
2024-09-05 23:06:32 +02:00
committed by Martin Hořeňovský
parent 77eca4e819
commit 02d3304782
19 changed files with 254 additions and 19 deletions

View File

@@ -76,7 +76,7 @@ namespace Catch {
{ TokenType::Argument,
next.substr( delimiterPos + 1, next.size() ) } );
} else {
if ( next[1] != '-' && next.size() > 2 ) {
if ( next.size() > 1 && next[1] != '-' && next.size() > 2 ) {
// Combined short args, e.g. "-ab" for "-a -b"
for ( size_t i = 1; i < next.size(); ++i ) {
m_tokenBuffer.push_back(