mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-12 09:20:36 +00:00
cut: Treat a range containing consecutive commas or dashes as invalid
This commit is contained in:
parent
bc56d71252
commit
da67d593d8
Notes:
sideshowbarker
2024-07-16 20:44:03 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/da67d593d8 Pull-request: https://github.com/SerenityOS/serenity/pull/19614
1 changed files with 2 additions and 2 deletions
|
@ -35,7 +35,7 @@ struct Range {
|
|||
|
||||
static bool expand_list(DeprecatedString& list, Vector<Range>& ranges)
|
||||
{
|
||||
Vector<DeprecatedString> tokens = list.split(',');
|
||||
Vector<DeprecatedString> tokens = list.split(',', SplitBehavior::KeepEmpty);
|
||||
|
||||
for (auto& token : tokens) {
|
||||
if (token.length() == 0) {
|
||||
|
@ -75,7 +75,7 @@ static bool expand_list(DeprecatedString& list, Vector<Range>& ranges)
|
|||
|
||||
ranges.append({ index.value(), SIZE_MAX });
|
||||
} else {
|
||||
auto range = token.split('-');
|
||||
auto range = token.split('-', SplitBehavior::KeepEmpty);
|
||||
if (range.size() == 2) {
|
||||
auto index1 = range[0].to_uint();
|
||||
if (!index1.has_value()) {
|
||||
|
|
Loading…
Reference in a new issue