about summary refs log tree commit diff
path: root/absl/strings/internal/str_format/parser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/strings/internal/str_format/parser.cc')
-rw-r--r--absl/strings/internal/str_format/parser.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/absl/strings/internal/str_format/parser.cc b/absl/strings/internal/str_format/parser.cc
index 5e3d0d0547d1..10487f23c855 100644
--- a/absl/strings/internal/str_format/parser.cc
+++ b/absl/strings/internal/str_format/parser.cc
@@ -99,10 +99,11 @@ bool ConsumeConversion(string_view *src, UnboundConversion *conv,
     // digit doesn't match the expected characters.
     int num_digits = std::numeric_limits<int>::digits10;
     for (;;) {
-      if (ABSL_PREDICT_FALSE(pos == end || !num_digits)) break;
+      if (ABSL_PREDICT_FALSE(pos == end)) break;
       c = *pos++;
       if (!std::isdigit(c)) break;
       --num_digits;
+      if (ABSL_PREDICT_FALSE(!num_digits)) break;
       digits = 10 * digits + c - '0';
     }
     return digits;