diff --git a/include/fmt/format.h b/include/fmt/format.h index f101c913..e4f7633d 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2328,16 +2328,22 @@ FMT_CONSTEXPR const Char* parse_arg_id(const Char* begin, const Char* end, IDHandler&& handler) { FMT_ASSERT(begin != end, ""); Char c = *begin; - if (c == '}' || c == ':') return handler(), begin; + if (c == '}' || c == ':') { + handler(); + return begin; + } if (c >= '0' && c <= '9') { int index = parse_nonnegative_int(begin, end, handler); if (begin == end || (*begin != '}' && *begin != ':')) - return handler.on_error("invalid format string"), begin; - handler(index); + handler.on_error("invalid format string"); + else + handler(index); + return begin; + } + if (!is_name_start(c)) { + handler.on_error("invalid format string"); return begin; } - if (!is_name_start(c)) - return handler.on_error("invalid format string"), begin; auto it = begin; do { ++it;