diff --git a/src/protocol/ArgParser.cxx b/src/protocol/ArgParser.cxx index deaa8f08f..2cfac9b33 100644 --- a/src/protocol/ArgParser.cxx +++ b/src/protocol/ArgParser.cxx @@ -107,7 +107,7 @@ ParseCommandArgRange(const char *s) range.end = (unsigned)value; } else { - range.end = (unsigned)value + 1; + return RangeArg::Single(range.start); } return range; diff --git a/src/protocol/RangeArg.hxx b/src/protocol/RangeArg.hxx index 246210b83..5f846350c 100644 --- a/src/protocol/RangeArg.hxx +++ b/src/protocol/RangeArg.hxx @@ -36,6 +36,13 @@ struct RangeArg { return OpenEnded(0); } + /** + * Construct an instance describing exactly one index. + */ + static constexpr RangeArg Single(unsigned i) noexcept { + return { i, i + 1 }; + } + constexpr bool operator==(RangeArg other) const noexcept { return start == other.start && end == other.end; }