Skip to content

Commit e98129e

Browse files
Don't touch begin iterator (pointer) if begin == end.
Fixes fmtlib#2661.
1 parent 35f6037 commit e98129e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/fmt/core.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -2482,6 +2482,8 @@ FMT_CONSTEXPR FMT_INLINE auto parse_format_specs(const Char* begin,
24822482
const Char* end,
24832483
SpecHandler&& handler)
24842484
-> const Char* {
2485+
if (begin == end) return begin;
2486+
24852487
if (begin + 1 < end && begin[1] == '}' && is_ascii_letter(*begin) &&
24862488
*begin != 'L') {
24872489
presentation_type type = parse_presentation_type(*begin++);
@@ -2491,8 +2493,6 @@ FMT_CONSTEXPR FMT_INLINE auto parse_format_specs(const Char* begin,
24912493
return begin;
24922494
}
24932495

2494-
if (begin == end) return begin;
2495-
24962496
begin = parse_align(begin, end, handler);
24972497
if (begin == end) return begin;
24982498

0 commit comments

Comments
 (0)