diff --git a/format.cc b/format.cc index a4c9cee6..fbb0d967 100644 --- a/format.cc +++ b/format.cc @@ -625,7 +625,8 @@ void fmt::BasicWriter::write_str( if (*str_value) str_size = std::char_traits::length(str_value); } - if (spec.precision_ >= 0 && spec.precision_ < str_size) + std::size_t precision = spec.precision_; + if (spec.precision_ >= 0 && precision < str_size) str_size = spec.precision_; write_str(str_value, str_size, spec); }