Fix bug in TokenStream parser

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

No files matched your search

+1 -1
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(