-
Notifications
You must be signed in to change notification settings - Fork 288
Open
Description
I wanted to use this lib to parse args in cutom 'interactive console', so I used std::cin to read the input and split it into the std::vectorstd::string and run it in a loop.
But if you input empty line (just press enter) -> empty vector -> argparse crashes in parse_args_internal because the iterators are invalid with empty vector.
You maybe want to do some sanity check for the input.
I solved it in my code by just inserting the name of the command in front of the vector:
args.insert(args.begin(), "<program_name>");
Is this an edge case? Yes
Did I spend way too much time on this because in my case I do not have access to debugger? Yes
Metadata
Metadata
Assignees
Labels
No labels