diff --git a/include/fmt/printf.h b/include/fmt/printf.h index 8c28ac23..b44afaba 100644 --- a/include/fmt/printf.h +++ b/include/fmt/printf.h @@ -474,8 +474,11 @@ OutputIt basic_printf_context::format() { const Char* end = parse_ctx_.end(); auto it = start; while (it != end) { + if (!detail::find(it, end, '%', it)) { + it = end; // detail::find leaves it == nullptr if it doesn't find '%' + break; + } char_type c = *it++; - if (c != '%') continue; if (it != end && *it == c) { out = std::copy(start, it, out); start = ++it;